Docker icon

Docker

Interact with Docker via Portainer API

Overview

This node allows users to retrieve logs from a Docker service managed via the Portainer API. It is useful for monitoring and debugging containerized services by fetching their runtime logs directly within an n8n workflow. Typical use cases include:

  • Viewing recent or historical logs of a specific Docker service.
  • Following live log output in real-time to monitor ongoing service behavior.
  • Filtering logs by standard output or error streams.
  • Adding timestamps or extra details to logs for better context.

For example, a DevOps engineer could use this node to automatically fetch and analyze logs after deploying a new version of a service, or trigger alerts based on error messages found in the logs.

Properties

Name Meaning
EndpointID Name or ID The identifier of the Docker endpoint to connect to. Can be selected from a list of available endpoints or specified via an expression.
Id The ID or name of the Docker service whose logs are to be retrieved.
Additional Fields Optional parameters to customize the log retrieval:
- Details Whether to show service context and extra details in the logs (boolean).
- Follow Whether to keep the connection open to continuously receive new log entries (boolean).
- Stdout Return logs from the standard output stream (boolean).
- Stderr Return logs from the standard error stream (boolean).
- Since Only return logs since this UNIX timestamp (number).
- Timestamps Add timestamps to every log line (boolean).
- Tail Number of log lines to return from the end, or all to return all logs (string).

Output

The node outputs JSON data containing the logs retrieved from the specified Docker service. The structure typically includes the raw log lines, optionally enriched with timestamps and additional context depending on the input options. If the "Follow" option is enabled, the node may continue streaming logs until stopped.

No binary data output is indicated.

Dependencies

  • Requires access to a Portainer API instance managing Docker endpoints.
  • Needs an API authentication token configured as credentials in n8n to authorize requests.
  • The node dynamically loads available Docker endpoints from the Portainer API.

Troubleshooting

  • Common issues:
    • Invalid or missing endpoint ID or service ID will cause failures in retrieving logs.
    • Network connectivity problems to the Portainer API will prevent log access.
    • Insufficient permissions or invalid API credentials can result in authorization errors.
  • Error messages:
    • Errors related to "Not Found" usually indicate incorrect service or endpoint identifiers.
    • Authentication errors suggest misconfigured or expired API tokens.
  • Resolutions:
    • Verify that the endpoint and service IDs are correct and accessible.
    • Ensure the API credentials are valid and have sufficient permissions.
    • Check network connectivity and Portainer API availability.

Links and References

Discussion