Portainer icon

Portainer

Trabalhe com dados da API do Portainer para gerenciar Docker

Overview

The node integrates with the Portainer API to manage Docker resources. Specifically, for the Image resource and the Inspect operation, it retrieves detailed metadata about a specific Docker image within a given Portainer environment (endpoint). This is useful when you want to programmatically obtain comprehensive information about an image, such as its configuration, layers, creation date, size, and other attributes.

Practical scenarios include:

  • Auditing or verifying image details before deployment.
  • Automating workflows that require image inspection data.
  • Integrating image metadata into dashboards or reports.

Example: Inspecting an image by its ID in a particular environment to fetch its JSON metadata for further processing or decision-making.

Properties

Name Meaning
Environment ID The ID of the Portainer environment/endpoint where the Docker image resides.
Image ID The unique identifier of the Docker image to inspect.

Output

The node outputs a JSON object containing the full inspection details of the specified Docker image as returned by the Portainer API. This includes all metadata fields available from the Docker engine via Portainer, such as:

  • Image ID
  • Creation timestamp
  • Container configuration
  • Layer history
  • Size and virtual size
  • Labels and tags
  • Parent image info
  • Architecture and OS details

This output allows downstream nodes or processes to access rich image metadata for automation or analysis.

The node does not output binary data for this operation.

Dependencies

  • Requires a configured Portainer API credential with:

    • Base URL of the Portainer instance.
    • An API key/token for authentication.
  • The node makes HTTP GET requests to the Portainer API endpoint:

    /endpoints/{environmentId}/docker/images/{imageId}/json
    
  • Ensure the Portainer instance is accessible from the n8n environment.

Troubleshooting

  • Common issues:

    • Invalid or missing Environment ID or Image ID parameters will cause request failures.
    • Network connectivity problems to the Portainer API endpoint.
    • Insufficient permissions or invalid API key may result in authorization errors.
    • Specifying an Image ID that does not exist in the environment will return a "not found" error.
  • Error messages:

    • 404 Not Found: The specified image ID does not exist in the given environment.
    • 401 Unauthorized or 403 Forbidden: API key is invalid or lacks required permissions.
    • Network Error or ECONNREFUSED: Unable to reach the Portainer API; check network and base URL.
  • Resolutions:

    • Verify that the Environment ID and Image ID are correct.
    • Confirm the API key credential is valid and has sufficient rights.
    • Check network connectivity and Portainer server status.
    • Review Portainer user permissions related to image inspection.

Links and References

Discussion