Actions86
- Config Actions
- Container Actions
- Edge Group Actions
- Edge Stack Actions
- Environment Actions
- Image Actions
- Network Actions
- Node Actions
- Registry Actions
- Secret Actions
- Service Actions
- Setting Actions
- Stack Actions
- System Actions
- Team Actions
- Template Actions
- User Actions
- Volume Actions
- Webhook Actions
Stack → Update
AI-generatedOverview
This node operation updates an existing Docker Compose stack in Portainer. It allows users to modify the stack by providing the stack ID, environment ID (endpoint), the updated stack file content (docker-compose.yml), and optional environment variables. Users can also specify whether to prune services that are no longer referenced in the updated stack. This operation is useful for managing and maintaining Docker stacks through Portainer's API, enabling automated updates and configuration changes to containerized applications.
Use Case Examples
- Updating a stack's docker-compose.yml file to deploy new service versions or configuration changes.
- Adding or modifying environment variables for a stack to change runtime behavior.
- Pruning unused services from a stack to clean up resources.
Properties
| Name | Meaning |
|---|---|
| Environment ID | The ID of the environment/endpoint in Portainer where the stack is deployed. |
| Stack ID | The unique identifier of the stack to update. |
| Stack File Content | The contents of the docker-compose.yml file or stack file defining the stack's services and configuration. |
| Environment Variables | A collection of environment variables to set for the stack, each with a name and value. |
| Prune Services | A boolean flag indicating whether to prune services that are no longer referenced in the updated stack. |
Output
JSON
body- The JSON response from Portainer API after updating the stack, typically containing the updated stack details or status.
Dependencies
- Portainer API with an API key credential for authentication
Troubleshooting
- Ensure the Environment ID and Stack ID are correct and correspond to existing resources in Portainer.
- Verify that the stack file content is valid YAML and correctly formatted as a docker-compose file.
- If environment variables are provided, ensure they are correctly formatted as name-value pairs.
- Check API key permissions to confirm the user has rights to update stacks.
- Common errors include 404 Not Found if the stack or environment does not exist, 400 Bad Request for invalid stack file content, and 401 Unauthorized if API credentials are invalid.
Links
- Portainer API - Update Stack - Official Portainer API documentation for updating stacks.