Docker icon

Docker

Interact with Docker via Portainer API

Overview

This node allows you to interact with Docker containers through the Portainer API, specifically enabling you to export a container's filesystem as a tar archive. This operation is useful when you want to back up a container's data, migrate it, or inspect its contents outside of the running environment.

Common scenarios include:

  • Exporting a container before making major changes for backup purposes.
  • Migrating container data between environments.
  • Archiving container state for auditing or debugging.

For example, you can select a specific Docker endpoint managed by Portainer, specify the container by its ID or name, and export its entire filesystem as a downloadable archive.

Properties

Name Meaning
EndpointID Name or ID The Docker endpoint managed by Portainer to target. Choose from a list of available endpoints or specify an ID via expression.
Id The ID or name of the container you want to export.

Output

The node outputs JSON data representing the result of the container export operation. Typically, this will be the binary content of the exported container filesystem in tar format. If the node supports binary output, this binary data corresponds to the container's archived filesystem, which can be saved or processed further.

Dependencies

  • Requires access to a Portainer instance with API enabled.
  • Needs an API key credential for authenticating requests to the Portainer API.
  • The node depends on the Portainer API endpoint URL and the selected Docker endpoint within Portainer.
  • The portainerApiRequest function is used internally to make authenticated HTTP requests to the Portainer API.

Troubleshooting

  • Invalid EndpointID: If the specified endpoint ID does not exist or is unreachable, the node will fail. Ensure the endpoint is correctly selected and accessible.
  • Container Not Found: If the container ID or name is incorrect or the container does not exist on the selected endpoint, the export will fail. Verify the container identifier.
  • Authentication Errors: Missing or invalid API credentials will cause authentication failures. Confirm that the API key credential is valid and has sufficient permissions.
  • Network Issues: Connectivity problems between n8n and the Portainer server can cause request timeouts or failures. Check network settings and firewall rules.

Links and References

Discussion