Docker icon

Docker

Interact with Docker via Portainer API

Actions107

Overview

This node allows you to interact with Docker containers through the Portainer API, specifically enabling you to resize a container's TTY session. Resizing the TTY session is useful when you need to adjust the terminal dimensions of a running container, for example, to better fit logs or interactive shell sessions within your UI or automation workflows.

Common scenarios include:

  • Dynamically adjusting container terminal size during automated deployments or debugging.
  • Ensuring proper display formatting when attaching to container consoles programmatically.
  • Integrating container management into broader DevOps pipelines where terminal resizing is required.

Properties

Name Meaning
EndpointID Name or ID The Portainer endpoint to access Docker. Choose from a list of available endpoints or specify an ID via expression.
Id The ID or name of the Docker container to resize.
H Height of the TTY session in characters (number).
W Width of the TTY session in characters (number).

Output

The node outputs JSON data representing the response from the Portainer API after attempting to resize the container's TTY session. This typically includes status information about the resize operation.

No binary data output is expected from this operation.

Dependencies

  • Requires a valid Portainer API URL and an API authentication token configured as credentials in n8n.
  • The node uses the Portainer API endpoint /api/endpoints/{endpointId}/docker/containers/{id}/resize with query parameters h and w for height and width respectively.
  • The user must have appropriate permissions on the Portainer instance to perform container operations.

Troubleshooting

  • Invalid EndpointID or Container ID: Ensure that the selected endpoint and container ID exist and are accessible via the provided Portainer API credentials.
  • Permission Denied Errors: Verify that the API key used has sufficient rights to manage containers on the specified endpoint.
  • Incorrect Height or Width Values: Provide positive integer values for height and width; zero or negative values may cause errors.
  • API Connectivity Issues: Confirm that the Portainer API URL is reachable from the n8n environment and that network/firewall settings allow communication.

Links and References

Discussion