Portainer icon

Portainer

Trabalhe com dados da API do Portainer para gerenciar Docker

Overview

This node integrates with the Portainer API to manage Docker Swarm secrets. Specifically, the Secret - Create operation allows users to create a new secret in a specified Docker environment managed by Portainer. This is useful for securely storing sensitive data such as passwords, tokens, or certificates that can be used by Docker services without exposing them in plain text.

Typical use cases include:

  • Automating the creation of secrets during CI/CD pipelines.
  • Managing secrets centrally for multiple Docker environments/endpoints.
  • Integrating secret management into broader workflows involving container orchestration.

For example, you might use this node to create a secret containing database credentials that your Docker services will consume at runtime.

Properties

Name Meaning
Environment ID The ID of the Portainer environment/endpoint where the secret will be created.
Secret Name The name identifier for the secret to be created.
Secret Data The actual secret content/data, which will be base64 encoded before sending to Portainer.

Output

The node outputs JSON data representing the response from the Portainer API after creating the secret. This typically includes details about the newly created secret such as its ID, name, creation timestamp, and other metadata returned by the API.

No binary data output is involved in this operation.

Dependencies

  • Requires an active connection to a Portainer instance with API access.
  • Needs an API key credential configured in n8n to authenticate requests to the Portainer API.
  • The Portainer API base URL and API key must be set in the node credentials.

Troubleshooting

  • Authentication errors: Ensure the API key credential is valid and has sufficient permissions to create secrets in the target environment.
  • Invalid environment ID: Verify that the provided environment ID corresponds to an existing and accessible Portainer endpoint.
  • Secret name conflicts: If a secret with the same name already exists, the API may reject the creation request. Use unique names or handle updates separately.
  • Data encoding issues: The secret data is base64 encoded before sending; ensure the input data is correctly formatted and does not contain unsupported characters.
  • Network connectivity: Confirm that the n8n instance can reach the Portainer API endpoint URL.

Links and References

Discussion