# How can I ensure Portainer's configuration is retained?

#### Docker Standalone

The commands in our [installation guide](/start/install/server.md) include the creation of a portainer\_data volume for Portainer to store data, and using this will ensure that the configuration remains even when the Portainer container is restarted, upgraded or removed.

#### Docker Swarm&#x20;

Our [recommended deployment](/start/install/server/swarm.md) stack file constrains Portainer to a manager node, which will work well if you have a single manager node. If you have multiple managers however this will potentially become a problem. Each stack or service update action could move the Portainer container between manager nodes, and you may see Portainer appear as a fresh install. One solution is to constrain your Portainer container to the node where your Portainer data is being persisted. To do this, you will first need to find the hostname of the node where the Portainer volume is being persisted. Within Portainer, from the menu select **Volumes** and note down the value in the **Host** column for your Portainer volume (usually called portainer\_portainer\_data). In the below example, this is ce-manager01.

<figure><img src="/files/dnRK0Nq2XxUR7l4pPU0S" alt=""><figcaption></figcaption></figure>

Next, from the menu select **Services** then the portainer\_portainer service, then click **Placement constraints**.

<figure><img src="/files/w3TIp6gUGQTpOXYqPISA" alt=""><figcaption></figcaption></figure>

Click the **placement constraint** button to add a new constraint. Enter node.hostname for the **Name** and the hostname you gathered previously for the **Value**.

<figure><img src="/files/VRxypgSQXq1arzb72vaZ" alt=""><figcaption></figcaption></figure>

#### Kubernetes

For Kubernetes environments we recommend using a default StorageClass with cluster-available storage to avoid issues. Alternatively you can use a nodeSelector with your deployment to restrict the Portainer instance to a chosen node. This method is described in more detail in our [Kubernetes installation guide.](/start/install/server/kubernetes/baremetal.md)


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.portainer.io/faqs/installing/how-can-i-ensure-portainers-configuration-is-retained.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
