Portainer icon

Portainer

Trabalhe com dados da API do Portainer para gerenciar Docker

Overview

This node integrates with the Portainer API to manage Docker images, specifically enabling the "Pull" operation for Docker images. The "Pull" operation downloads a Docker image from a registry into a specified Docker environment managed by Portainer.

Common scenarios where this node is beneficial include:

  • Automating the retrieval of updated Docker images from registries before deploying containers.
  • Integrating image management into CI/CD pipelines to ensure the latest images are available.
  • Managing multiple Docker environments/endpoints centrally via Portainer.

Practical example:

  • Pulling the official nginx image with the tag latest into a specific Docker environment identified by its environment ID, preparing it for container creation or update.

Properties

Name Meaning
Environment ID The ID of the Docker environment/endpoint in Portainer where the image will be pulled.
Image Name The name of the Docker image to pull (e.g., nginx).
Image Tag The tag of the Docker image to pull (default is latest).

Output

The node outputs JSON data representing the response from the Portainer API after attempting to pull the image. This typically includes details about the pull operation status and any metadata returned by the Docker daemon via Portainer.

No binary data output is involved in this operation.

Dependencies

  • Requires an active Portainer instance accessible via its API.
  • Requires an API key credential configured in n8n to authenticate requests to the Portainer API.
  • The node uses the Portainer API endpoint /endpoints/{environmentId}/docker/images/create with a POST request to perform the pull.

Troubleshooting

  • Common issues:

    • Invalid or missing Environment ID: Ensure the environment ID corresponds to a valid Docker endpoint in Portainer.
    • Incorrect image name or tag: Verify the image name and tag exist in the target registry.
    • Authentication errors: Confirm that the API key credential has sufficient permissions and is correctly configured.
    • Network connectivity issues between n8n and the Portainer server.
  • Error messages:

    • HTTP 401 Unauthorized: Check API key validity and permissions.
    • HTTP 404 Not Found: The specified environment or image may not exist.
    • HTTP 500 Internal Server Error: Could indicate issues on the Portainer server or Docker daemon; check server logs.

Resolving these usually involves verifying credentials, parameters, and network access.

Links and References

Discussion