Portainer icon

Portainer

Trabalhe com dados da API do Portainer para gerenciar Docker

Overview

This node integrates with the Portainer API to manage Docker containers and other Docker-related resources. Specifically, for the Container - Delete operation, it allows users to delete a Docker container from a specified environment (endpoint) managed by Portainer.

Typical use cases include:

  • Automating cleanup of unused or stopped containers.
  • Removing containers programmatically as part of CI/CD pipelines or infrastructure management workflows.
  • Managing container lifecycle remotely via Portainer's API without direct Docker CLI access.

For example, you can delete a container by specifying its ID and the environment where it runs, optionally forcing deletion even if the container is in use, and choosing whether to remove associated volumes.

Properties

Name Meaning
Environment ID The ID of the Portainer environment/endpoint where the container resides.
Container ID The unique identifier of the container to be deleted.
Force Delete Whether to force deletion even if the container is currently in use. (true/false)
Remove Volumes Whether to also remove volumes associated with the container when deleting it. (true/false)

Output

The output of this operation is the JSON response returned by the Portainer API after attempting to delete the container. Typically, this will be an empty object or confirmation of successful deletion.

No binary data is produced by this operation.

Dependencies

  • Requires a valid connection to a Portainer instance with API access.
  • An API key credential must be configured in n8n to authenticate requests to the Portainer API.
  • The node uses the base URL and API key from the configured credentials to send HTTP DELETE requests to the Portainer endpoint managing Docker containers.

Troubleshooting

  • Common issues:

    • Invalid or missing Environment ID or Container ID will cause the API call to fail.
    • Insufficient permissions or invalid API key may result in authorization errors.
    • Trying to delete a container that is running without setting Force Delete to true might fail.
    • Network connectivity issues to the Portainer server will prevent the request from succeeding.
  • Error messages:

    • 404 Not Found: The specified container or environment does not exist. Verify IDs.
    • 401 Unauthorized: Authentication failed. Check API key and credentials.
    • 409 Conflict: Container is in use and Force Delete is false. Set Force Delete to true to override.
    • 500 Internal Server Error: Server-side error; check Portainer logs and status.

To resolve errors, ensure all required parameters are correct, the API key has sufficient privileges, and the Portainer server is reachable.

Links and References

Discussion