Portainer icon

Portainer

Interact with Portainer via API

Actions190

Stacks → Stack Create Docker Standalone File

AI-generated

Overview

This node operation allows you to create a new Docker stack in a specified environment using a standalone stack file. It interacts with a container management platform's API to deploy the stack by sending the stack configuration and optional environment variables.

Common scenarios for this node include automating deployment of multi-container Docker applications, managing infrastructure as code, or integrating stack deployments into CI/CD pipelines. For example, you could use it to programmatically deploy a web application stack defined in a Docker Compose file to a remote Docker environment.

Properties

Name Meaning
Endpoint Id Identifier of the target environment where the stack will be deployed.
Name The name to assign to the new stack being created.
Env Environment variables to pass during deployment, formatted as a JSON array of objects with name and value keys.
File The stack file content defining the services and configuration of the Docker stack (e.g., a Docker Compose file).

Output

The node outputs JSON data representing the response from the stack creation API call. This typically includes details about the newly created stack such as its ID, status, and any metadata returned by the server.

If the stack file or environment variables are invalid, the output may contain error information describing what went wrong.

No binary data output is expected from this operation.

Dependencies

  • Requires an API key credential to authenticate with the container management platform.
  • Needs the base URL of the platform’s API configured in the credentials.
  • The stack file must be provided in a supported format (commonly a Docker Compose YAML or JSON).
  • The environment must be reachable via the provided endpoint identifier.

Troubleshooting

  • Invalid Endpoint Id: If the environment identifier does not exist or is incorrect, the API will reject the request. Verify the endpoint ID corresponds to a valid environment.
  • Malformed Stack File: Errors can occur if the stack file content is not properly formatted or missing required fields. Ensure the file is valid and correctly structured.
  • Incorrect Environment Variables Format: The Env property must be a JSON array of objects with name and value. Invalid JSON or incorrect structure will cause deployment failure.
  • Authentication Errors: Missing or invalid API credentials will prevent communication with the platform. Confirm that the API key and base URL are correctly set.
  • API Response Errors: Check the error messages returned in the output JSON for specific issues like permission denied, resource conflicts, or server errors.

Links and References

Discussion