Docker icon

Docker

Interact with Docker via Portainer API

Overview

This node allows you to interact with Docker containers through the Portainer API. Specifically, the "Container Kill" operation sends a kill signal to a specified container on a chosen Docker endpoint managed by Portainer. This is useful for forcefully stopping or terminating containers that are unresponsive or need immediate shutdown.

Practical examples include:

  • Stopping a misbehaving container that does not respond to graceful stop commands.
  • Automating cleanup of containers in CI/CD pipelines.
  • Managing container lifecycle remotely via Portainer endpoints.

Properties

Name Meaning
EndpointID Name or ID The Portainer endpoint to access Docker. Choose from a list of available endpoints or specify an ID using an expression.
Id The ID or name of the Docker container to be killed.
Additional Fields Optional extra parameters:
  Signal The signal to send to the container (e.g., SIGKILL, SIGINT). Defaults to SIGKILL.

Output

The node outputs JSON data representing the response from the Portainer API after sending the kill signal to the container. This typically includes status information about the operation's success or failure.

No binary data output is involved.

Dependencies

  • Requires a Portainer API endpoint URL and an API key credential configured in n8n to authenticate requests.
  • Uses the Portainer API to manage Docker containers remotely.
  • The node dynamically loads available endpoints from the Portainer instance.

Troubleshooting

  • Common issues:

    • Invalid or missing endpoint ID: Ensure the selected endpoint exists and is accessible.
    • Incorrect container ID or name: Verify the container identifier is correct.
    • Insufficient permissions: The API key must have rights to manage containers on the specified endpoint.
    • Network connectivity problems between n8n and the Portainer server.
  • Error messages:

    • Authentication errors: Check API credentials and endpoint URL.
    • Container not found: Confirm the container ID/name is valid on the selected endpoint.
    • Signal format errors: Use valid signal names or integers (e.g., SIGKILL).

Links and References

Discussion