# Migrate, duplicate or rename a stack

To migrate, duplicate, or rename a stack, open your environment, go to **Stacks**, and select the stack you want to change.

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

## Migrating a stack

### Docker Compose to Kubernetes migration

{% hint style="warning" %}
Migrating Docker stacks to Kubernetes is currently an experimental feature and is not recommended for production workloads.

Before starting the migration, we recommend [taking a backup](/sts/admin/settings/general.md#back-up-portainer).
{% endhint %}

Portainer allows you to migrate your Docker Compose workloads to Kubernetes. This feature uses the [Kompose](https://kompose.io/) tool to convert Docker Compose definitions into Kubernetes resources.

From the stack you want to migrate, select **Migrate this stack**. In the dialog box that appears, select your Kubernetes environment as the destination for the migration, then complete the fields as described below. Click **Migrate**.

| Field                 | Overview                                                                                                                                                                   |
| --------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Namespace             | Specify the [namespace](/sts/user/kubernetes/namespaces.md) you wish to migrate to. If the namespace you enter does not exist, a new one will be created during migration. |
| Convert to Helm chart | Toggle this on to convert your stack to a Helm chart. Note that if migrating to a Helm chart, the preview function will no longer be an option.                            |

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

### Migration between Docker environments

From the stack you want to migrate, select **Migrate this stack**. Select the destination environment for the stack, and optionally define a new name for the stack. Click **Migrate**.

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

Migrating does not relocate the content of any persistent volumes that may be attached to the stack. Acknowledge this warning and confirm the migration by clicking **Migrate**.

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

## Duplicating a stack

From the stack you want to duplicate, select **Migrate this stack**. Give the new stack a descriptive name then select the environment the stack should duplicate to. Click **Duplicate**.

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

## Rename a stack

From the stack you want to rename, select **Migrate this stack**. Give the stack a new descriptive name and select the environment that the stack is currently on. Click **Rename**.

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

Renaming the stack creates a new stack instance and does not transfer the content of any persistent volumes that may be attached to the stack. Acknowledge this warning and confirm the migration by clicking **Rename**.

<figure><img src="/files/4phmBEPEZUzr8ZuecGvQ" alt=""><figcaption></figcaption></figure>


---

# 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/sts/user/docker/stacks/migrate.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.
