Actions88
- Container Actions
- Container List
- Container Create
- Container Inspect
- Container Top
- Container Logs
- Container Changes
- Container Export
- Container Stats
- Container Resize
- Container Start
- Container Stop
- Container Restart
- Container Kill
- Container Update
- Container Rename
- Container Pause
- Container Unpause
- Container Attach
- Container Attach Websocket
- Container Wait
- Container Delete
- Container Archive Info
- Container Archive
- Put Container Archive
- Container Prune
- Image Actions
- Network Actions
- Volume Actions
- Swarm Actions
- Node Actions
- Secret Actions
- System Actions
- Exec Actions
- Service Actions
- Task Actions
Overview
This node enables building Docker images by interacting with a Docker environment through the Portainer API. It is designed to send a tar archive containing the build context (including a Dockerfile) to the Docker daemon and trigger an image build process.
Common scenarios where this node is useful include:
- Automating Docker image builds as part of CI/CD pipelines.
- Building custom container images dynamically based on input streams or remote Git repositories.
- Integrating Docker image creation into workflows that manage container deployments.
For example, you can use this node to build a Docker image from a compressed tarball of your application source code and Dockerfile, tag it, and then push it to a registry in subsequent workflow steps.
Properties
| Name | Meaning |
|---|---|
| EndpointID Name or ID | Selects the Docker endpoint (server) via Portainer API to which the build request will be sent. You can choose from a list or specify an ID using an expression. |
| Input Stream | The tar archive (compressed or uncompressed) containing the build context, including the Dockerfile and other files needed for the image build. |
| Additional Fields | A collection of optional parameters to customize the build: |
| - Dockerfile | Path within the build context to the Dockerfile. Ignored if remote is specified. Defaults to "Dockerfile". |
| - T | Image name and optional tag in name:tag format to apply to the built image. Multiple tags can be provided. |
| - Extrahosts | Extra hosts to add to /etc/hosts during build. |
| - Remote | URI to a Git repository or HTTP/HTTPS context. Can point to a single Dockerfile or a tarball used as build context. |
| - Q | Suppress verbose build output (boolean). |
| - Nocache | Do not use cache when building the image (boolean). |
| - Cachefrom | JSON array of images used for build cache resolution. |
| - Pull | Attempt to pull the image even if an older image exists locally. |
| - Rm | Remove intermediate containers after successful build (boolean, default true). |
| - Forcerm | Always remove intermediate containers, even upon failure (boolean). |
| - Memory | Memory limit for the build in bytes. |
| - Memswap | Total memory (memory + swap). Set -1 to disable swap. |
| - Cpushares | CPU shares (relative weight). |
| - Cpusetcpus | CPUs allowed for execution (e.g., 0-3, 0,1). |
| - Cpuperiod | Length of a CPU period in microseconds. |
| - Cpuquota | Microseconds of CPU time allowed in a CPU period. |
| - Buildargs | JSON map of string pairs for build-time variables (not for secrets). Example: {"FOO":"bar"}. |
| - Shmsize | Size of /dev/shm in bytes; must be > 0. Defaults to 64MB if omitted. |
| - Squash | Squash resulting image layers into a single layer (experimental). |
| - Labels | Arbitrary key/value labels as a JSON map to set on the image. |
| - Networkmode | Networking mode during build commands (bridge, host, none, `container:<name |
| - Content Type | Content-Type header for the request body. Default is application/x-tar. |
| - X Registry Config | Base64-encoded JSON object with authentication configurations for multiple registries used during build. |
| - Platform | Target platform in os[/arch[/variant]] format. |
| - Target | Target build stage in multi-stage Dockerfiles. |
| - Outputs | BuildKit output configuration string. |
| - Version | Builder backend version: 1 (classic, deprecated) or 2 (BuildKit). Default is 1. |
Output
The node outputs JSON data representing the response from the Docker API after attempting to build the image. This typically includes build logs, status messages, and metadata about the created image(s).
If the build produces binary data (such as image layers), it is handled internally by the Docker daemon and not directly output by this node.
Dependencies
- Requires access to a Portainer API endpoint configured with appropriate credentials (an API key or token).
- The node depends on the Portainer API to communicate with Docker endpoints.
- The user must configure credentials with the URL of the Portainer instance and valid authentication.
- The node uses the Portainer API's Docker endpoint to perform the image build operation.
Troubleshooting
- Invalid EndpointID: If the selected endpoint ID does not exist or is unreachable, the node will fail. Verify the endpoint is correctly configured in Portainer.
- Malformed Input Stream: The input stream must be a valid tar archive compressed with supported algorithms. Invalid archives will cause build failures.
- Dockerfile Not Found: If specifying a custom Dockerfile path or remote context, ensure the file exists at the given location.
- Authentication Errors: If pushing to private registries during build, ensure the
X Registry Configcontains correct base64-encoded auth info. - Resource Limits: Setting memory, CPU, or other resource limits incorrectly may cause build failures or unexpected behavior.
- BuildKit Version Mismatch: Using builder version
2requires Docker daemon support for BuildKit. Otherwise, fallback to version1. - Verbose Output Disabled: If build logs are missing, check if the
Q(quiet) option is enabled.