Portainer icon

Portainer

Interact with Portainer via API

Actions190

Stacks → Stack Migrate

AI-generated

Overview

The "Stack Migrate" operation in the Stacks resource allows migrating a stack within Portainer by sending migration details to the API. This node is useful when you need to update or move stack configurations programmatically, for example, during environment upgrades or when reorganizing stacks across different endpoints.

Practical examples include:

  • Migrating a stack's configuration to a new environment endpoint.
  • Updating stack definitions as part of an automated deployment pipeline.
  • Adjusting stack metadata or settings that require migration support.

Properties

Name Meaning
Id The unique identifier of the stack to migrate.
Body JSON string containing the stack migration details. This should include all necessary data describing how the stack should be migrated.
Additional Fields Optional parameters; currently supports:
• Endpoint Id: For stacks created before version 1.18.0 that might lack an associated environment (endpoint) identifier, this sets the environment (endpoint) ID used by the stack.

Output

The node outputs JSON data representing the response from the Portainer API after attempting the stack migration. This typically includes confirmation of the migration status, updated stack details, or error information if the migration failed.

No binary data output is expected from this operation.

Dependencies

  • Requires an API key credential for authenticating with the Portainer API.
  • The node expects the base URL of the Portainer instance to be configured in the credentials.
  • The Portainer API must be accessible and support the stack migration endpoint.

Troubleshooting

  • Common issues:

    • Invalid or missing stack Id can cause the API call to fail.
    • Malformed JSON in the Body property will result in request errors.
    • Using an outdated or incorrect Endpoint Id may lead to migration failures or unexpected behavior.
    • Network connectivity issues or incorrect API URL/credentials will prevent successful communication.
  • Error messages:

    • Authentication errors indicate invalid or missing API credentials.
    • Validation errors from the API often point to incorrect or incomplete migration details in the Body.
    • Not found errors suggest the specified stack Id does not exist.

Resolution tips:

  • Verify the stack Id is correct and exists in Portainer.
  • Ensure the Body contains valid JSON matching the expected migration schema.
  • Confirm the Endpoint Id is accurate if used.
  • Check API credentials and network connectivity.

Links and References

Discussion