Portainer icon

Portainer

Work with Portainer API data to manage Docker

Container → Stop

AI-generated

Overview

This node operation stops a running Docker container managed through Portainer. It sends a request to the Portainer API to stop the specified container within a given environment, optionally waiting for a specified timeout period before forcefully stopping it. This is useful for automating container lifecycle management, such as stopping containers during maintenance or scaling down services.

Use Case Examples

  1. Stopping a container by specifying its Container ID and Environment ID to gracefully shut down a service.
  2. Automating container stop operations in a CI/CD pipeline to manage resource usage.

Properties

Name Meaning
Environment ID The ID of the environment/endpoint in Portainer where the container is running.
Container ID The unique identifier of the container to stop.
Timeout Number of seconds to wait before forcefully stopping the container.

Output

JSON

  • body - The response body from the Portainer API after attempting to stop 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 correspond to existing resources in Portainer.
  • Timeout value should be a positive number; otherwise, the stop operation might fail or behave unexpectedly.
  • Check API key permissions to ensure the user has rights to stop containers.
  • Common errors include 404 Not Found if the container or environment does not exist, and 403 Forbidden if the API key lacks permissions.

Links

Discussion