Docker icon

Docker

Interact with Docker via Portainer API

Overview

This node allows you to upload and extract a tar archive into a specified directory inside a Docker container managed via the Portainer API. It is useful for scenarios where you need to programmatically copy files or directories into a running container, such as deploying application code, configuration files, or other resources without rebuilding the container image.

Practical examples:

  • Deploying updated static website files into a web server container.
  • Injecting configuration files or scripts into a container at runtime.
  • Automating backup restoration by extracting archived data inside containers.

Properties

Name Meaning
EndpointID Name or ID The Portainer endpoint to access the Docker environment. You can select from a list of available endpoints or specify an ID using an expression.
Id The ID or name of the target Docker container where the archive will be extracted.
Path The path inside the container where the contents of the archive will be extracted.
Input Stream The tar archive input stream to upload. Must be compressed with one of: identity (no compression), gzip, bzip2, or xz.
Additional Fields Optional additional parameters:
No Overwrite Dir Non Dir: If set to true (1, true, or True), it causes an error if unpacking would replace an existing directory with a non-directory or vice versa.
Copy UIDGID: If true (1, true), copies UID/GID mappings to the destination files or directories.

Output

The node outputs JSON data representing the response from the Portainer API after attempting to upload and extract the archive in the container. This typically includes status information about the operation.

If the node supports binary data input (the tar archive), it expects the archive content as a string input stream but does not output binary data itself.

Dependencies

  • Requires a Portainer API endpoint configured with appropriate credentials (an API key or token) to authenticate requests.
  • The node uses the Portainer API to interact with Docker containers.
  • The user must have access rights to the specified endpoint and container.
  • The input archive must be a valid tar archive compressed with supported algorithms.

Troubleshooting

  • Invalid Container ID or Name: Ensure the container ID or name exists on the selected endpoint.
  • Incorrect Path: The extraction path inside the container must be valid and writable.
  • Unsupported Archive Format: The input stream must be a tar archive compressed with one of the supported algorithms (identity, gzip, bzip2, or xz).
  • Permission Errors: The Portainer API credentials must have sufficient permissions to perform container file operations.
  • No Overwrite Dir Non Dir Conflict: If this option is enabled and the archive tries to overwrite a directory with a non-directory or vice versa, the operation will fail.
  • Network or Endpoint Issues: Verify connectivity to the Portainer endpoint URL and that the endpoint is online.

Links and References

Discussion