Image
Image is a field in the DALEC spec that allows you to customize certain aspects of the produced image. The image field is an object with the following properties:
base
: The image ref to use as the base for the output container. [Deprecated: usebases
instead] base sectionbases
: The list of base images to use as the base for the output container(s). bases sectionpost
: The post processing for the image, such as symlinks. post sectionlabels
: The labels for the image. This is an optional field. labels sectionenv
: The environment variables for the image. This is an optional field. env sectionentrypoint
: The entrypoint for the image. This is an optional field. entrypoint sectioncmd
: The command for the image. This is an optional field. cmd sectionworkdir
: The working directory for the image. This is an optional field. workdir sectionuser
: The user for the image. This is an optional field. user sectionstop_signal
: The stop signal for the image. This is an optional field. stop signal sectionvolumes
: The volumes for the image. This is an optional field. volumes section
The base
field is deprecated. Use the bases
field instead.
For bases
, the requested build target may not support multiple base images.
In this cases the target will produce an error.
Currently only windowscross/container
supports multiple base images for the
purpose of building for multiple windows versions.
If multiple bases are provided with the same os.version
value in the image
platform, this may produce an error or at least unexpected results since images
are keyed on the image platform metadata.
With the exception of base
, bases
, and post
, these fields are all used to
merge with the configured (or default) base image(s).
Base
The base
field is used to specify the base image for the output container.
Example:
image:
base: mcr.microsoft.com/cbl-mariner/distroless/minimal:2.0
Bases
As noted above, the bases
field is used to specify the base image(s) for the
output container(s).
Multiple bases can be specified for the same target, but the target must support
it.
Currently the only built-in target that supports this is windowscross/container
where each base image specified is used to build for a different Windows version.
Example:
image:
bases:
- rootfs:
image:
ref: mcr.microsoft.com/cbl-mariner/distroless/minimal:2.0
The data type allows specifying any kind of source for the base image,
however currently only the image
source is supported. Anything else will produce
an error.
Support for other source types may be added in the future.
Post
The post
field is used to specify post processing for the image.
The following fields are supported:
symlinks
: A list of symlinks to create in the image.
Example:
image:
post:
symlinks:
/usr/bin/my-binary: # Where the symlink points to
path: /my-binary # Where to place the symlink
Labels
The labels
field is used to specify labels for the image.
Example:
image:
labels:
com.example.label: example
Env
The env
field is used to specify environment variables for the image.
Example:
image:
env:
- MY_ENV_VAR=my-value
Entrypoint
The entrypoint
field is used to specify the entrypoint for the image.
Example:
image:
entrypoint: /usr/bin/my-binary
Cmd
The cmd
field is used to specify the command for the image.
Example:
image:
cmd: /usr/bin/my-binary
Workdir
The workdir
field is used to specify the working directory for the image.
Example:
image:
workdir: /my-dir
User
The user
field is used to specify the user for the image.
Example:
image:
user: my-user:my-group
Alterantively
image:
user: my-user
You may also use uid/gid values:
image:
user: 1000:1000
Or just user:
image:
user: 1000
User and group names are not automatically created for you, so it must be in the base OS to a username to work.
Stop Signal
The stop_signal
field is used to specify the stop signal for the image.
This is used by the container runtime to know what signal to use to gracefully
stop the container.
Example:
image:
stop_signal: SIGINT
Volumes
The volumes
field is used to specify volumes for the image.
Example:
image:
volumes:
/some-path: {}
This is always a map of the path to create the volume at and an empty object.