Docker icon

Docker

Interact with Docker via Portainer API

Actions107

Overview

This node allows you to update a Docker volume via the Portainer API. It is useful when you need to modify certain properties of an existing Docker volume managed through Portainer, specifically its availability status. This operation ensures safe updates by requiring the current version number of the volume to prevent conflicting writes.

Practical examples include:

  • Changing the availability of a volume in a Docker environment managed by Portainer.
  • Automating volume configuration updates as part of a CI/CD pipeline or infrastructure management workflow.

Properties

Name Meaning
EndpointID Name or ID Select or specify the Portainer endpoint ID that will be used to access the Docker API. You can choose from a list of available endpoints or provide an ID using an expression.
Name The name or ID of the Docker volume you want to update.
Version The current version number of the volume being updated. This is required to avoid conflicting writes and must match the version found in the volume's ClusterVolume field.
Body The specification of the volume update in JSON string format. Currently, only the Availability property may be changed; all other fields must remain unchanged.

Output

The node outputs the JSON response returned by the Portainer API after updating the volume. This typically includes details about the updated volume resource reflecting the changes made.

If the API returns binary data (not indicated here), it would represent raw response content, but this node primarily deals with JSON data.

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 specified endpoint ID being valid.
  • Uses the Portainer API path /api/endpoints/{endpointId}/docker/volumes/{name} for volume update operations.

Troubleshooting

  • Version Mismatch Error: If the version number provided does not match the current version of the volume, the API will reject the update to prevent conflicts. Ensure you retrieve the latest version before updating.
  • Invalid Endpoint ID: Selecting or specifying an incorrect endpoint ID will cause connection failures. Verify the endpoint exists and is reachable.
  • Malformed Body: The body must be a valid JSON string representing the volume spec. Invalid JSON or unsupported changes (other than Availability) will cause errors.
  • Authentication Errors: Missing or invalid API credentials will result in authorization failures. Confirm your API key and URL are correctly set in the node credentials.

Links and References

Discussion