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 Delete Secret operation allows users to remove a secret from a Docker Swarm environment managed by Portainer. This is useful for cleaning up unused or sensitive secrets that should no longer be accessible in your Docker infrastructure.

Typical use cases include:

  • Automating cleanup of secrets after they are no longer needed.
  • Managing secret lifecycle as part of CI/CD pipelines.
  • Ensuring compliance by removing outdated or compromised secrets.

For example, you might use this node to delete a secret identified by its ID from a specific Docker environment endpoint in Portainer, optionally forcing deletion even if the secret is currently in use.

Properties

Name Meaning
Environment ID The ID of the Portainer environment/endpoint where the secret exists (e.g., "1").
Secret ID The unique identifier of the Docker Swarm secret to delete.
Force Delete Boolean flag indicating whether to force deletion even if the secret is currently in use.

Output

The node outputs JSON data representing the response from the Portainer API after attempting to delete the secret. Typically, this will be an empty object or confirmation of successful deletion. No binary data is output by this operation.

Example output JSON might look like:

{}

indicating the secret was deleted successfully.

Dependencies

  • Requires a configured Portainer API credential with:
    • Base URL of the Portainer instance.
    • An API key for authentication.
  • The node sends HTTP DELETE requests to the Portainer API endpoint corresponding to the secret resource.

Troubleshooting

  • Common issues:

    • Invalid or missing Environment ID or Secret ID parameters.
    • Insufficient permissions or invalid API key leading to authorization errors.
    • Attempting to delete a secret that does not exist or has already been deleted.
    • Network connectivity issues to the Portainer API endpoint.
  • Error messages and resolutions:

    • 401 Unauthorized: Check that the API key credential is valid and has sufficient permissions.
    • 404 Not Found: Verify the Environment ID and Secret ID are correct and the secret exists.
    • 409 Conflict or similar when not using force delete: If the secret is in use, enable the "Force Delete" option to override.
    • Network errors: Ensure the Portainer base URL is reachable from n8n and there are no firewall restrictions.

Links and References

Discussion