Portainer icon

Portainer

Work with Portainer API data to manage Docker

Container → Restart

AI-generated

Overview

This node operation allows users to restart a Docker container managed by Portainer. It is useful in scenarios where a container needs to be refreshed or reset without deleting it, such as applying configuration changes or recovering from an error state. For example, restarting a web server container to apply new environment variables or updates.

Use Case Examples

  1. Restart a container by specifying the environment ID and container ID, optionally setting a timeout for the restart operation.
  2. Use this operation to automate container restarts in response to monitoring alerts or deployment workflows.

Properties

Name Meaning
Environment ID The ID of the environment/endpoint in Portainer where the container is running. This is required to target the correct Docker environment.
Container ID The unique identifier of the container to restart. This is required to specify which container to restart.
Timeout Number of seconds to wait before forcefully stopping the container during the restart process. Optional, defaults to 10 seconds.

Output

JSON

  • body - The JSON response from the Portainer API after attempting to restart the container, typically indicating success or failure status.

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.
  • Check that the API key credential has sufficient permissions to restart containers.
  • Timeout value should be a positive number; invalid values may cause the request to fail.
  • If SSL issues occur, consider enabling the option to ignore SSL certificate validation in the node settings.

Links

Discussion