Actions86
- Config Actions
- Container Actions
- Edge Group Actions
- Edge Stack Actions
- Environment Actions
- Image Actions
- Network Actions
- Node Actions
- Registry Actions
- Secret Actions
- Service Actions
- Setting Actions
- Stack Actions
- System Actions
- Team Actions
- Template Actions
- User Actions
- Volume Actions
- Webhook Actions
Container → Delete
AI-generatedOverview
This node operation deletes a Docker container in a specified environment using the Portainer API. It allows users to remove a container by providing the environment ID and container ID. Additionally, it supports options to force deletion even if the container is in use and to remove associated volumes during deletion. This operation is useful for managing container lifecycle and cleaning up unused or problematic containers in Docker environments.
Use Case Examples
- Deleting a stopped container to free up resources.
- Force deleting a container that is currently in use or stuck.
- Deleting a container along with its associated volumes to reclaim disk space.
Properties
| Name | Meaning |
|---|---|
| Environment ID | The ID of the environment/endpoint in Portainer 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. |
| Remove Volumes | Whether to remove associated volumes when deleting the container. |
Output
JSON
body- Response body from the Portainer API after deleting the container, typically indicating success or failure.
Dependencies
- Portainer API with an API key credential for authentication
Troubleshooting
- Ensure the environment ID and container ID are correct and exist in Portainer.
- If force delete is not enabled, deletion may fail if the container is running or in use.
- Check API key permissions to ensure the user has rights to delete containers.
- Network or connectivity issues with the Portainer API endpoint may cause request failures.
Links
- Portainer API - Delete Container - Official Portainer API documentation for deleting Docker containers.