Docker icon

Docker

Interact with Docker via Portainer API

Actions107

Overview

This node allows users to interact with Docker through the Portainer API, specifically enabling the "Image Commit" operation. The "Image Commit" operation creates a new Docker image from an existing container’s changes. This is useful when you want to save the current state of a container as a new image for later use or distribution.

Common scenarios include:

  • Saving a container’s state after manual modifications or debugging.
  • Creating custom images based on running containers without writing a full Dockerfile.
  • Automating image creation workflows in CI/CD pipelines.

For example, after modifying a container interactively, you can commit those changes into a new image tagged appropriately and optionally add metadata like author or comments.

Properties

Name Meaning
EndpointID Name or ID Selects the Docker endpoint (Portainer environment) to target. You can choose from a list of available endpoints or specify an ID via expression.
Container Config JSON string representing the container configuration to be used during the commit request body.
Additional Fields A collection of optional parameters:
- Container The ID or name of the container to commit.
- Repo Repository name for the created image.
- Tag Tag name for the created image.
- Comment Commit message describing the image.
- Author Author information for the image (e.g., John Hannibal Smith <hannibal@a-team.com>).
- Pause Boolean flag indicating whether to pause the container before committing (default true).
- Changes Dockerfile instructions to apply while committing (e.g., CMD, ENV directives).

Output

The node outputs JSON data representing the response from the Portainer API after committing the image. This typically includes details about the newly created image such as its ID, repository, tag, and other metadata.

If binary data were involved (not indicated here), it would represent image layers or similar artifacts, but this node focuses on JSON responses only.

Dependencies

  • Requires access to a Portainer API endpoint configured with appropriate credentials (an API key or token).
  • The node depends on the Portainer API being accessible at the URL specified in the credentials.
  • Uses the Portainer API /api/endpoints/{endpointId}/docker path to perform Docker operations.
  • Requires the user to select or provide a valid Docker endpoint ID within Portainer.

Troubleshooting

  • Invalid Endpoint ID: If the selected endpoint ID does not exist or is unreachable, the node will fail. Verify the endpoint exists in Portainer and the API URL is correct.
  • Authentication Errors: Ensure the API credentials provided have sufficient permissions to commit images.
  • Malformed Container Config: The containerConfig property must be a valid JSON string representing container configuration; invalid JSON will cause errors.
  • Container Not Found: If the specified container ID or name does not exist on the endpoint, the commit will fail.
  • Pause Option Issues: Setting pause to false may cause inconsistent image states if the container is actively changing during commit.
  • API Rate Limits or Network Issues: Standard network troubleshooting applies if requests time out or are throttled.

Links and References

Discussion