Portainer icon

Portainer

Interact with Portainer via API

Actions190

Stacks → Stack Create Docker Standalone Repository

AI-generated

Overview

This node operation allows you to create a new Docker standalone stack repository in Portainer by sending a stack configuration to a specified environment endpoint. It is useful for automating the deployment of Docker stacks via Portainer's API, especially when managing multiple environments or orchestrating containerized applications programmatically.

Practical examples include:

  • Deploying a new Docker stack with a predefined configuration to a specific environment.
  • Automating stack updates or creation as part of a CI/CD pipeline.
  • Managing multiple Docker environments from a centralized workflow.

Properties

Name Meaning
Endpoint Id Identifier of the environment where the Docker stack will be deployed (a numeric ID).
Body The stack configuration content as a string, typically in YAML or JSON format.

Output

The node outputs JSON data representing the response from the Portainer API after attempting to create the Docker standalone stack. This typically includes details about the created stack such as its ID, name, status, and any relevant metadata returned by the API.

No binary data output is expected from this operation.

Dependencies

  • Requires an active connection to a Portainer instance via its API.
  • Needs an API authentication token or key configured in the node credentials to authorize requests.
  • The Portainer API base URL must be set correctly in the credentials.
  • The environment identified by the Endpoint Id must exist and be accessible.

Troubleshooting

  • Common issues:

    • Invalid or missing Endpoint Id can cause the request to fail; ensure the environment ID is correct.
    • Malformed stack configuration in the Body property may lead to API errors; validate the stack config syntax before sending.
    • Authentication failures if the API key or token is incorrect or expired.
    • Network connectivity problems between n8n and the Portainer server.
  • Error messages:

    • "Unauthorized" or "Authentication failed": Check API credentials and permissions.
    • "Invalid endpoint" or "Environment not found": Verify the Endpoint Id corresponds to an existing environment.
    • "Bad Request" or "Invalid stack configuration": Review the stack config content for syntax errors or unsupported options.

Resolving these usually involves verifying credentials, ensuring the environment exists, and validating the stack configuration format.

Links and References

Discussion