Portainer icon

Portainer

Work with Portainer API data to manage Docker

Container → Delete

AI-generated

Overview

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

  1. Deleting a stopped container to free up resources.
  2. Force deleting a container that is currently in use or stuck.
  3. 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

Discussion