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 configs. Specifically, the Config - Create operation allows users to create a new Docker Swarm config within a specified Portainer environment (endpoint). This is useful for managing configuration data that can be injected into Docker services or containers in a Swarm cluster.

Typical use cases include:

  • Automating the creation of configuration files or secrets as Docker configs.
  • Managing application settings or credentials centrally via Docker Swarm configs.
  • Integrating Docker config management into automated workflows or CI/CD pipelines.

For example, you might use this node to create a config named "app-settings" containing JSON configuration data, which can then be referenced by your Docker services.

Properties

Name Meaning
Environment ID The ID of the Portainer environment/endpoint where the config will be created.
Config Name The name to assign to the new Docker Swarm config.
Config Data The raw content/data of the config. This will be base64 encoded before sending to Portainer.

Output

The node outputs the JSON response from the Portainer API after creating the config. This typically includes details about the newly created config 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 Portainer.
  • The Portainer environment ID must correspond to a valid endpoint configured in Portainer.

Troubleshooting

  • Invalid Environment ID: If the environment ID does not exist or is incorrect, the API call will fail. Verify the environment ID corresponds to a valid Portainer endpoint.
  • Authentication Errors: Ensure the API key credential is valid and has sufficient permissions to create configs.
  • Malformed Config Data: The config data is base64 encoded before sending; ensure the input string is correctly formatted and does not contain invalid characters.
  • API Endpoint Unreachable: Network issues or incorrect base URL in credentials can cause failures. Confirm connectivity to the Portainer API URL.

Common error messages usually come directly from the Portainer API and may indicate permission issues, invalid parameters, or resource conflicts.

Links and References

Discussion