Portainer icon

Portainer

Interact with Portainer via API

Actions190

Stacks → Stack Associate

AI-generated

Overview

This node integrates with Portainer's API to associate a stack with specific environment and swarm identifiers. It is useful in scenarios where you manage containerized applications using Portainer and need to programmatically link stacks to particular environments and swarms, for example, during automated deployment or infrastructure orchestration workflows.

Practical examples include:

  • Associating a newly created stack with a target Docker Swarm cluster.
  • Updating stack associations when migrating environments.
  • Automating environment setup by linking stacks to the correct endpoints and swarms.

Properties

Name Meaning
Id The unique identifier of the stack to associate.
Endpoint Id The identifier of the environment (endpoint) where the stack will be associated.
Swarm Id The identifier of the swarm within the environment to associate the stack with.
Orphaned Running Boolean flag indicating whether the stack is considered orphaned (running without owner).

Output

The node outputs JSON data representing the result of the stack association operation. This typically includes confirmation details such as the updated stack information or status response from the Portainer API. There is no indication that binary data is output by this node.

Dependencies

  • Requires an API key credential for authenticating with the Portainer API.
  • Needs the base URL of the Portainer instance configured in the credentials.
  • Depends on the Portainer API being accessible and properly configured to allow stack management operations.

Troubleshooting

  • Common issues:
    • Invalid or missing API credentials can cause authentication failures.
    • Incorrect stack, endpoint, or swarm IDs may lead to "not found" errors.
    • Network connectivity problems between n8n and the Portainer server can cause request timeouts.
  • Error messages:
    • Authentication errors: Verify the API key and base URL in the credentials.
    • Resource not found: Double-check the provided stack, endpoint, and swarm IDs.
    • Permission denied: Ensure the API key has sufficient privileges to modify stacks.

Links and References

Discussion