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 config creation into CI/CD pipelines or infrastructure automation workflows.

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 returned by 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.

The output JSON structure corresponds to the Portainer API's response for a successful config creation request.

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 node uses the Portainer API endpoint URL and API key from the configured credentials.
  • The target Portainer environment (endpoint) must exist and be accessible.

Troubleshooting

  • Invalid Environment ID: If the provided environment ID does not exist or is inaccessible, the API call will fail. Verify the environment ID is correct and the Portainer instance is reachable.
  • 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 Errors: Any errors returned by the Portainer API (e.g., duplicate config name) will be passed through. Check the error message for details and adjust parameters accordingly.

Links and References

Discussion