Docker icon

Docker

Interact with Docker via Portainer API

Overview

This node interacts with Docker through the Portainer API, specifically allowing users to retrieve a list of Docker images from a selected Docker endpoint managed by Portainer. It is useful for scenarios where you want to programmatically access and manage Docker images across different environments or servers via Portainer's centralized API.

A practical example includes automating the retrieval of all Docker images available on a specific Docker host (endpoint) to monitor image usage, perform cleanup tasks, or integrate with CI/CD pipelines that require image metadata.

Properties

Name Meaning
EndpointID Name or ID Selects the Docker endpoint (host) managed by Portainer from which to fetch images. You can choose from a dropdown list or specify an ID using an expression. This is required.
Additional Fields Optional additional filters for the request:
- Names A JSON array of image names to filter the results by. For example, ["nginx", "redis"] will return only those images matching these names.

Output

The node outputs JSON data representing the list of Docker images retrieved from the specified endpoint. Each item in the output corresponds to one Docker image and contains its metadata as returned by the Portainer API. The exact structure depends on the Portainer API response but typically includes fields like image ID, repository tags, creation date, size, etc.

No binary data output is indicated.

Dependencies

  • Requires a valid Portainer API authentication token configured in the node credentials.
  • Needs network access to the Portainer server URL.
  • Uses the Portainer API endpoint /api/endpoints/{endpointId}/docker/images/json to fetch images.
  • The node dynamically loads available endpoints from Portainer to populate the endpoint selection dropdown.

Troubleshooting

  • Common issues:
    • Invalid or missing Portainer API credentials will cause authentication errors.
    • Incorrect or unavailable endpoint IDs will result in failed requests or empty results.
    • Network connectivity problems between n8n and the Portainer server can cause timeouts or connection errors.
  • Error messages:
    • Authentication failures usually indicate invalid API tokens or insufficient permissions.
    • "Endpoint not found" or similar errors suggest the specified endpoint ID does not exist or is inaccessible.
  • Resolutions:
    • Verify and update the API credentials.
    • Confirm the endpoint ID is correct and the endpoint is active in Portainer.
    • Ensure n8n has network access to the Portainer server.

Links and References

Discussion