Docker icon

Docker

Interact with Docker via Portainer API

Actions107

Overview

This node allows users to create a Docker service via the Portainer API. It is useful for automating container orchestration tasks such as deploying new services in a Docker Swarm environment managed through Portainer. Typical use cases include continuous deployment pipelines, scaling applications by creating new services programmatically, or integrating Docker service management into broader workflows.

For example, a user can specify the target Docker endpoint and provide the full service specification in JSON format to create a new service on that Docker host.

Properties

Name Meaning
EndpointID Name or ID The identifier of the Docker endpoint (host) where the service will be created. Users can select from a list of available endpoints or specify an ID using an expression.
Body The JSON string representing the service specification to be sent in the request body. This should conform to the Docker service creation API schema.
Additional Fields Optional extra fields to customize the request. Currently supports:
- X Registry Auth: A base64url-encoded authentication configuration used when pulling images from private registries.

Output

The node outputs the JSON response returned by the Portainer API after attempting to create the Docker service. This typically includes details about the newly created service or error information if the creation failed.

No binary data output is produced by this node.

Dependencies

  • Requires access to a Portainer instance with its API enabled.
  • Requires an API key or token credential for authenticating requests to the Portainer API.
  • The node dynamically loads available Docker endpoints from the Portainer API to populate the endpoint selection.
  • The user must provide a valid Docker service specification JSON in the "Body" property.

Troubleshooting

  • Invalid Endpoint ID: If the specified endpoint ID does not exist or is inaccessible, the node will fail. Ensure the endpoint exists in Portainer and the API credentials have permission to access it.
  • Malformed Service Specification: Providing invalid JSON or incorrect service parameters in the "Body" field will cause the API to reject the request. Validate the JSON against Docker's service creation schema.
  • Authentication Errors: Missing or incorrect API credentials will result in authorization failures. Verify the API key/token and URL are correct.
  • Private Registry Authentication: If pulling images from private registries, ensure the "X Registry Auth" header is correctly base64url-encoded and matches the expected format; otherwise, image pulls may fail.

Links and References

Discussion