Docker icon

Docker

Interact with Docker via Portainer API

Actions107

Overview

This node interacts with Docker containers through the Portainer API, specifically to retrieve container statistics. It is useful for monitoring container resource usage such as CPU, memory, network, and disk I/O in real-time or as a one-time snapshot. Typical use cases include:

  • Monitoring container performance metrics for alerting or logging.
  • Integrating container stats into dashboards or reports.
  • Automating scaling or maintenance tasks based on container resource consumption.

For example, you can configure this node to stream live stats of a specific container to track its resource usage continuously, or fetch a single snapshot of stats for periodic checks.

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. This determines which Docker environment the node will query.
Id The ID or name of the Docker container whose stats you want to retrieve.
Additional Fields Optional parameters:
Stream: Whether to stream stats continuously (true) or get a single output and disconnect (false).
One Shot: If stream is false, set this to true to get only one stat cycle.

Output

The node outputs JSON data containing the container statistics retrieved from the Docker API via Portainer. The structure typically includes fields such as CPU usage, memory usage, network I/O, and block I/O metrics for the specified container.

If streaming is enabled, the node outputs continuous updates of these stats. If not, it outputs a single snapshot.

No binary data output is produced by this node.

Dependencies

  • Requires a configured Portainer API credential with URL and authentication token.
  • Depends on the Portainer API being accessible and the specified endpoint existing.
  • Uses the Portainer API /api/endpoints/{endpointId}/docker/containers/{id}/stats endpoint.

Troubleshooting

  • Common issues:

    • Invalid or missing endpoint ID: Ensure the selected endpoint exists and is reachable.
    • Incorrect container ID or name: Verify the container identifier is correct and the container is running.
    • Network or authentication errors: Confirm that the Portainer API credentials are valid and the API server is accessible.
  • Error messages:

    • Authentication failures: Check API key/token validity and permissions.
    • 404 Not Found: Usually means the container or endpoint does not exist.
    • Timeout or connection errors: Network issues or incorrect base URL configuration.

Resolving these usually involves verifying credentials, endpoint/container IDs, and network connectivity.

Links and References

Discussion