Docker icon

Docker

Interact with Docker via Portainer API

Overview

This node interacts with Docker through the Portainer API to list Docker networks associated with a specified endpoint. It is useful for users who want to retrieve and filter network information from their Docker environments managed by Portainer. Typical use cases include monitoring network configurations, auditing network usage, or integrating Docker network data into automation workflows.

For example, you can list all networks on a specific Docker endpoint or filter networks that are currently unused (dangling) or match certain driver types.

Properties

Name Meaning
EndpointID Name or ID The identifier of the Docker endpoint to access via the Portainer API. You can select from a list of available endpoints or specify an ID directly using an expression. This determines which Docker environment the node will query.
Additional Fields Optional extra parameters to refine the network listing. Currently supports:
- Filters: A JSON-encoded string representing filters to apply on the network list. Available filters include:
- dangling (boolean): Return only networks not in use (true) or those in use (false).
- driver: Filter by network driver name.
- id: Match part or whole network ID.
- label: Filter by network label key or key-value pair.
- name: Match part or whole network name.
- scope: Filter by scope (swarm, global, or local).
- type: Filter by type (custom for user-defined networks or builtin).

Output

The node outputs JSON data containing the list of Docker networks retrieved from the specified endpoint. Each item in the output corresponds to a network object as returned by the Portainer API, including details such as network ID, name, driver, labels, scope, and usage status.

If binary data were involved (not applicable here), it would be summarized accordingly, but this node deals exclusively with JSON network metadata.

Dependencies

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

Troubleshooting

  • Common issues:

    • Incorrect or missing endpoint ID: Ensure the selected endpoint exists and is accessible.
    • Authentication failures: Verify that the API key or token credential is valid and has sufficient permissions.
    • Malformed filters JSON: When using filters, ensure the JSON string is correctly formatted according to the expected structure.
    • Network connectivity problems between n8n and the Portainer server.
  • Error messages:

    • Authorization errors typically indicate invalid or missing credentials.
    • HTTP errors may indicate incorrect endpoint URLs or network issues.
    • Parsing errors when filters are malformed; validate JSON syntax carefully.

Links and References

Discussion