Portainer icon

Portainer

Trabalhe com dados da API do Portainer para gerenciar Docker

Overview

This node integrates with the Portainer API to manage Docker volumes. Specifically, the Delete Volume operation allows users to delete a Docker volume from a specified environment (endpoint) in Portainer. This is useful for cleaning up unused or obsolete volumes that consume disk space or are no longer needed by containers.

Typical use cases include:

  • Automating cleanup of Docker volumes after container removal.
  • Managing storage resources programmatically in multi-environment Docker setups.
  • Integrating volume lifecycle management into CI/CD pipelines or infrastructure automation workflows.

Example: Deleting a volume named my_volume from environment ID 1, optionally forcing deletion even if the volume is currently in use.

Properties

Name Meaning
Environment ID The ID of the Portainer environment/endpoint where the volume exists.
Volume Name The name of the Docker volume to be deleted.
Force Delete Whether to force deletion even if the volume is currently in use (boolean: true or false).

Output

The node outputs JSON data representing the response from the Portainer API after attempting to delete the volume. Typically, this will confirm successful deletion or provide error details if the operation failed.

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 base URL and API key must be set in the node credentials for proper communication.

Troubleshooting

  • Common Issues:

    • Attempting to delete a volume that does not exist or is misspelled will result in an error.
    • Trying to delete a volume that is currently in use without setting "Force Delete" may fail.
    • Network connectivity issues or incorrect API credentials can cause authentication or connection errors.
  • Error Messages:

    • 404 Not Found: The specified volume name does not exist in the given environment.
    • 409 Conflict: The volume is in use; enable "Force Delete" to override.
    • 401 Unauthorized: Invalid or missing API key credential.
  • Resolutions:

    • Verify the volume name and environment ID are correct.
    • Enable "Force Delete" if you intend to remove volumes in use.
    • Check and update API credentials and ensure network access to the Portainer server.

Links and References

Discussion