Actions107
- Node Actions
- Network Actions
- Container Actions
- Container List
- Container Create
- Container Inspect
- Container Top
- Container Logs
- Container Changes
- Container Export
- Container Stats
- Container Resize
- Container Start
- Container Stop
- Container Restart
- Container Kill
- Container Update
- Container Rename
- Container Pause
- Container Unpause
- Container Attach
- Container Attach Websocket
- Container Wait
- Container Delete
- Container Archive Info
- Container Archive
- Put Container Archive
- Container Prune
- Image Actions
- Volume Actions
- Swarm Actions
- Secret Actions
- System Actions
- Exec Actions
- Service Actions
- Task Actions
- Config Actions
- Plugin Actions
- Distribution Actions
- Session Actions
Overview
This node allows you to interact with Docker containers through the Portainer API, specifically enabling you to attach to a running container's input/output streams. Attaching to a container is useful for monitoring real-time logs, interacting with the container’s standard input (stdin), or streaming output (stdout/stderr). Common scenarios include debugging running containers, viewing live logs, or sending commands directly to a container’s terminal.
For example, you might use this node to:
- Stream logs from a container that has been running for some time.
- Attach to a container’s stdin to send commands interactively.
- Capture both stdout and stderr streams for real-time monitoring.
Properties
| Name | Meaning |
|---|---|
| EndpointID Name or ID | The Portainer endpoint ID used to access the Docker environment. You can select from a list of available endpoints or specify an ID via expression. |
| Id | The ID or name of the Docker container you want to attach to. |
| Additional Fields | A collection of optional parameters to customize the attach behavior: |
| - Detach Keys | Override the key sequence used to detach from the container. Accepts a single character [a-z] or ctrl-<value> where <value> can be a-z, @, ^, [, ,, or _. |
| - Logs | Boolean flag to replay previous logs from the container before attaching. Useful to see all output since the container started. |
| - Stream | Boolean flag to stream attached output from the time the request is made onwards. |
| - Stdin | Boolean flag to attach to the container’s standard input stream. |
| - Stdout | Boolean flag to attach to the container’s standard output stream. |
| - Stderr | Boolean flag to attach to the container’s standard error stream. |
Output
The node outputs JSON data representing the response from the Portainer API when attaching to the specified container. This typically includes streamed log or output data from the container’s attached streams (stdin, stdout, stderr) depending on the options selected.
If streaming is enabled, the output will continuously provide new data as it arrives from the container. If logs are requested, the output will first contain historical logs followed by live stream data if streaming is also enabled.
Binary data is not explicitly handled by this node; all output is expected to be textual/log data in JSON format.
Dependencies
- Requires a Portainer API endpoint configured with appropriate credentials (an API key or token).
- The node depends on the Portainer API being accessible at the URL provided in the credentials.
- Uses the Portainer API
/api/endpoints/{endpointId}/docker/containers/{id}/attachendpoint to perform the attach operation.
Troubleshooting
Common issues:
- Invalid or missing endpoint ID: Ensure the correct Portainer endpoint is selected or specified.
- Container ID/name not found: Verify the container exists and the ID/name is correct.
- Insufficient permissions: The API key must have rights to access the endpoint and container.
- Network connectivity issues to the Portainer server.
Error messages:
- HTTP 404 Not Found: Container or endpoint does not exist.
- HTTP 401 Unauthorized or 403 Forbidden: Authentication failure or insufficient permissions.
- Timeout or connection errors: Check network connectivity and Portainer server status.
Resolving these usually involves verifying credentials, endpoint configuration, container existence, and network access.