Docker icon

Docker

Interact with Docker via Portainer API

Actions107

Overview

This node allows users to update a Docker node configuration via the Portainer API. It is designed to interact with Docker environments managed through Portainer, enabling updates to specific nodes by specifying their ID and version. This is useful in scenarios where you need to programmatically modify Docker node settings or metadata within a Portainer-managed environment.

Practical examples include:

  • Updating node labels or metadata for better organization.
  • Changing node availability or role configurations.
  • Automating node updates as part of CI/CD pipelines managing container orchestration.

Properties

Name Meaning
EndpointID Name or ID The identifier of the Portainer endpoint to access. You can select from a list of available endpoints or specify an ID using an expression. This determines which Docker environment the node update will target.
Id The unique identifier of the Docker node to update. This is required to specify exactly which node's configuration should be modified.
Version The version number of the node object being updated. This is necessary to prevent conflicting writes by ensuring the update applies to the correct version of the node data.
Body The JSON string representing the body of the update request. This contains the new configuration or data to apply to the node.

Output

The node outputs the response from the Portainer API after attempting to update the specified Docker node. The output is structured as JSON and typically includes details about the updated node or confirmation of the successful update. There is no binary data output.

Dependencies

  • Requires a valid Portainer API endpoint URL and an API key credential configured in n8n to authenticate requests.
  • Depends on the Portainer API being accessible and the user having sufficient permissions to update Docker nodes.
  • Uses the Portainer API path /api/endpoints/{endpointId}/docker to perform operations.

Troubleshooting

  • Common issues:
    • Incorrect or missing EndpointID may cause connection failures or inability to find the target Docker environment.
    • Providing an outdated Version number can lead to conflict errors due to concurrent modifications.
    • Malformed JSON in the Body property will result in request errors.
  • Error messages:
    • "Conflict" or similar HTTP 409 errors indicate version mismatches; ensure the version number matches the current node version.
    • Authentication errors suggest invalid or missing API credentials.
    • "Not Found" errors may mean the node ID or endpoint ID does not exist or is inaccessible.

Links and References

Discussion