Build
type: "io.kestra.plugin.docker.Build"
Build a Docker image and push it to a remote container registry.
Examples
Build and push a Docker image to a registry
id: docker_build
namespace: company.team
tasks:
- id: build
type: io.kestra.plugin.docker.Build
dockerfile: |
FROM ubuntu
ARG APT_PACKAGES=""
RUN apt-get update && apt-get install -y --no-install-recommends ${APT_PACKAGES};
platforms:
- linux/amd64
tags:
- private-registry.io/unit-test:latest
buildArgs:
APT_PACKAGES: curl
labels:
unit-test: "true"
credentials:
registry: <registry.url.com>
username: <your-user>
password: <your-password>
Properties
tags
- Type: array
- SubType: string
- Dynamic: ✔️
- Required: ✔️
The list of tag of this image.
If pushing to a custom registry, the tag should include the registry URL. Note that if you want to push to an insecure registry (HTTP), you need to edit the
/etc/docker/daemon.json
file on your Kestra host to this and restart docker service (sudo systemctl daemon-reload && sudo systemctl restart docker
).
buildArgs
- Type: object
- SubType: string
- Dynamic: ✔️
- Required: ❌
Optional build arguments in a key: value
format.
credentials
- Type: Credentials
- Dynamic: ❌
- Required: ❌
Credentials to push your image to a container registry.
dockerfile
- Type: string
- Dynamic: ✔️
- Required: ❌
The contents of your Dockerfile passed as a string, or a path to the Dockerfile
host
- Type: string
- Dynamic: ✔️
- Required: ❌
The URI of your Docker host e.g. localhost
inputFiles
- Type:
- object
- string
- Dynamic: ✔️
- Required: ❌
The files to create on the local filesystem. It can be a map or a JSON object.
labels
- Type: object
- SubType: string
- Dynamic: ✔️
- Required: ❌
Additional metadata for the image in a key: value
format.
namespaceFiles
- Type: NamespaceFiles
- Dynamic: ❌
- Required: ❌
Inject namespace files.
Inject namespace files to this task. When enabled, it will, by default, load all namespace files into the working directory. However, you can use the
include
orexclude
properties to limit which namespace files will be injected.
platforms
- Type: array
- SubType: string
- Dynamic: ✔️
- Required: ❌
The target platform for the image e.g. linux/amd64.
pull
- Type: boolean
- Dynamic: ✔️
- Required: ❌
- Default:
true
Always attempt to pull the latest version of the base image.
push
- Type: boolean
- Dynamic: ✔️
- Required: ❌
- Default:
false
Whether to push the image to a remote container registry.
Outputs
imageId
- Type: string
- Required: ❌
The generated image id.
Definitions
io.kestra.core.models.tasks.NamespaceFiles
Properties
enabled
- Type: boolean
- Dynamic: ❌
- Required: ❌
- Default:
true
Whether to enable namespace files to be loaded into the working directory. If explicitly set to true
in a task, it will load all Namespace Files into the task's working directory. Note that this property is by default set to true
so that you can specify only the include
and exclude
properties to filter the files to load without having to explicitly set enabled
to true
.
exclude
- Type: array
- SubType: string
- Dynamic: ❌
- Required: ❌
A list of filters to exclude matching glob patterns. This allows you to exclude a subset of the Namespace Files from being downloaded at runtime. You can combine this property together with include
to only inject a subset of files that you need into the task's working directory.
include
- Type: array
- SubType: string
- Dynamic: ❌
- Required: ❌
A list of filters to include only matching glob patterns. This allows you to only load a subset of the Namespace Files into the working directory.
io.kestra.plugin.scripts.runner.docker.Credentials
Properties
auth
- Type: string
- Dynamic: ✔️
- Required: ❌
The registry authentication.
The
auth
field is a base64-encoded authentication string ofusername:password
or a token.
identityToken
- Type: string
- Dynamic: ✔️
- Required: ❌
The identity token.
password
- Type: string
- Dynamic: ✔️
- Required: ❌
The registry password.
registry
- Type: string
- Dynamic: ✔️
- Required: ❌
The registry URL.
If not defined, the registry will be extracted from the image name.
registryToken
- Type: string
- Dynamic: ✔️
- Required: ❌
The registry token.
username
- Type: string
- Dynamic: ✔️
- Required: ❌
The registry username.
Was this page helpful?