Docker icon

Docker

Interact with Docker via Portainer API

Actions107

Overview

This node allows users to interact with Docker containers through the Portainer API, specifically focusing on starting an existing exec instance within a container. The "Exec Start" operation initiates a command execution session that was previously created in a Docker container.

Common scenarios include:

  • Automating container management workflows where commands need to be executed inside running containers.
  • Starting interactive or background processes inside containers as part of CI/CD pipelines.
  • Managing containerized applications remotely via Portainer's API without direct Docker CLI access.

For example, after creating an exec instance to run a shell command inside a container, this node can start that exec session to execute the command.

Properties

Name Meaning
EndpointID Name or ID Selects the Portainer endpoint (Docker environment) to target. Can choose from a list or specify an ID via expression.
Id The unique identifier of the exec instance to start. This is required to specify which exec session to initiate.
Exec Start Config Optional JSON string configuration for starting the exec instance. This can include parameters like whether to attach stdin, stdout, etc.

Output

The node outputs JSON data representing the response from the Portainer API when starting the exec instance. This typically includes status information about the started exec session.

If the exec start operation involves streaming or binary data (e.g., interactive terminal output), the node may handle or forward such binary data accordingly, but this is not explicitly detailed in the source.

Dependencies

  • Requires a valid Portainer API URL and authentication credentials configured in n8n.
  • Depends on the Portainer API being accessible and the specified endpoint ID being valid.
  • Uses an internal helper method to load available endpoints dynamically for user selection.

Troubleshooting

  • Invalid Endpoint ID: If the selected endpoint does not exist or is unreachable, the node will fail. Verify the endpoint ID and network connectivity.
  • Invalid Exec Instance ID: Providing a wrong or non-existent exec instance ID will cause errors. Ensure the exec instance was created successfully before starting it.
  • Malformed Exec Start Config: If the JSON config string is invalid, the request may be rejected. Validate JSON syntax and supported options.
  • Authentication Errors: Missing or incorrect API credentials will prevent communication with Portainer. Confirm credentials are set up correctly.
  • API Version Mismatch: Using incompatible Portainer API versions might cause unexpected failures. Check compatibility with your Portainer server version.

Links and References

Discussion