Portainer icon

Portainer

Trabalhe com dados da API do Portainer para gerenciar Docker

Overview

This node integrates with the Portainer API to manage Docker containers and other Docker-related resources. Specifically, for the Container - Restart operation, it allows you to restart a running Docker container within a specified environment (endpoint) managed by Portainer.

Typical use cases include:

  • Automatically restarting containers after configuration changes or updates.
  • Recovering containers that have become unresponsive or are in an error state.
  • Managing container lifecycle as part of automated workflows or CI/CD pipelines.

For example, you might use this node to restart a web server container after deploying new code or to ensure critical services are restarted on schedule.

Properties

Name Meaning
Environment ID The ID of the Portainer environment/endpoint where the container is running.
Container ID The unique identifier of the Docker container to restart.
Timeout Number of seconds to wait before forcefully stopping the container during restart (default 10 seconds).

Output

The node outputs JSON data representing the response from the Portainer API after attempting to restart the container. This typically includes status information about the restart request but does not return detailed container state.

No binary data output is involved in this operation.

Dependencies

  • Requires access to a Portainer instance with its API enabled.
  • An API key credential for authenticating requests to the Portainer API must be configured in n8n.
  • The node uses the base URL and API key from the configured credentials to send HTTP POST requests to the Portainer endpoint.

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 authentication errors.
    • Network connectivity problems to the Portainer server can cause timeouts or connection errors.
  • Error messages:

    • Authentication errors usually indicate incorrect or expired API keys; verify and update credentials.
    • "Container not found" errors suggest the Container ID or Environment ID is incorrect or the container no longer exists.
    • Timeout errors may occur if the container takes too long to stop; increasing the timeout property can help.

Links and References


This summary is based solely on static analysis of the provided source code and property definitions.

Discussion