Actions72
- Image Actions
- Network Actions
- Node Actions
- Registry Actions
- Secret Actions
- Service Actions
- Stack Actions
- Team Actions
- Template Actions
- User Actions
- Volume Actions
- Webhook Actions
- Config Actions
- Container Actions
- Edge Group Actions
- Edge Stack Actions
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 maintenance workflows.
- Managing container lifecycle remotely via Portainer's API without direct Docker CLI access.
For example, you might use this node to delete a container by its ID in a given environment, optionally forcing deletion if the container is running or removing associated volumes to free up storage.
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 or running. |
| Remove Volumes | Whether to also remove volumes associated with the container when deleting it. |
Output
The node outputs JSON data representing the response from the Portainer API after attempting to delete the container. This typically includes status information about the deletion 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 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" may fail.
- Network connectivity issues to the Portainer server can cause request failures.
Error Messages:
- 404 Not Found: The specified container or environment does not exist. Verify IDs.
- 401 Unauthorized: Authentication failed. Check API key credentials.
- 409 Conflict: Container is in use and force delete was not enabled. Enable "Force Delete" to override.
- 500 Internal Server Error: Server-side error; check Portainer logs or retry later.
To resolve these, ensure correct IDs are used, API credentials are valid, and consider enabling "Force Delete" if appropriate.