Docker icon

Docker

Interact with Docker via Portainer API

Actions107

Overview

This node allows users to update a Docker secret via the Portainer API. It is useful in scenarios where you need to modify metadata (specifically labels) of an existing secret in a Docker environment managed through Portainer, without altering the secret's actual content. For example, you might want to add or change labels for organizational or automation purposes while ensuring the secret data remains unchanged.

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 secret update will target.
Id The ID or name of the secret to update. This uniquely identifies the secret within the selected endpoint.
Version The version number of the secret object being updated. This is required to prevent conflicting writes and ensure you are updating the correct revision of the secret.
Body The specification of the secret update. Currently, only the Labels field can be changed here. All other fields must remain as they were when retrieved from the SecretInspect endpoint. This should be provided as a JSON string.

Output

The node outputs JSON data representing the response from the Portainer API after attempting to update the secret. This typically includes details about the updated secret object, such as its ID, version, labels, and other metadata. There is no binary output.

Dependencies

  • Requires an active Portainer API endpoint with appropriate permissions.
  • Needs an API authentication token configured in n8n credentials to authorize requests to the Portainer API.
  • The node dynamically loads available endpoints from Portainer to populate the "EndpointID" property.

Troubleshooting

  • Version mismatch error: If the version number provided does not match the current version of the secret, the update will fail to avoid conflicting writes. To fix this, retrieve the latest secret version before updating.
  • Invalid body format: The "Body" property must be a valid JSON string containing only allowed changes (labels). Providing invalid JSON or modifying disallowed fields will cause errors.
  • Authentication issues: Ensure that the API key credential is correctly set up and has sufficient permissions to update secrets on the specified endpoint.
  • Endpoint not found: Selecting an invalid or inaccessible endpoint ID will result in connection errors. Verify the endpoint exists and is reachable.

Links and References

Discussion