Docker icon

Docker

Interact with Docker via Portainer API

Actions107

Overview

This node allows you to interact with Docker through the Portainer API, specifically enabling you to join a Docker Swarm cluster. The "Swarm Join" operation lets a Docker engine join an existing swarm by providing the necessary join parameters in the request body.

Common scenarios for this node include automating Docker Swarm cluster management, such as adding new nodes to a swarm programmatically or integrating swarm operations into CI/CD pipelines.

For example, you can use this node to add a new worker node to your Docker Swarm by specifying the appropriate join token and manager address in the body property.

Properties

Name Meaning
EndpointID Name or ID Select the Docker endpoint (Portainer environment) where the swarm join command will be executed. You can choose from a list of available endpoints or specify an ID using an expression.
Body JSON string containing the parameters required to join the swarm. This typically includes the join token, remote manager address, and other swarm join options.

Output

The node outputs the JSON response returned by the Portainer API after attempting to join the swarm. This usually contains confirmation details or error messages related to the join operation.

No binary data output is produced by this node.

Dependencies

  • Requires access to a Portainer instance with API enabled.
  • Requires an API key credential for authenticating requests to the Portainer API.
  • The node depends on the Portainer API's /api/endpoints/{endpointId}/docker/swarm/join endpoint.
  • The user must have at least one Docker endpoint configured in Portainer to select from.

Troubleshooting

  • Common issues:

    • Invalid or missing join token in the body will cause the join operation to fail.
    • Incorrect endpoint selection may lead to connection errors.
    • Network connectivity issues between n8n and the Portainer server.
  • Error messages:

    • Authentication errors if the API key credential is invalid or missing.
    • HTTP 400 or 403 errors if the join parameters are incorrect or insufficient permissions.
  • Resolutions:

    • Verify the correctness of the join token and other parameters in the body.
    • Ensure the selected endpoint is correct and accessible.
    • Confirm that the API key credential has sufficient permissions.
    • Check network connectivity and Portainer API availability.

Links and References

Discussion