Skip to main content

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: use bases instead] base section
  • bases: The list of base images to use as the base for the output container(s). bases section
  • post: The post processing for the image, such as symlinks. post section
  • labels: The labels for the image. This is an optional field. labels section
  • env: The environment variables for the image. This is an optional field. env section
  • entrypoint: The entrypoint for the image. This is an optional field. entrypoint section
  • cmd: The command for the image. This is an optional field. cmd section
  • workdir: The working directory for the image. This is an optional field. workdir section
  • user: The user for the image. This is an optional field. user section
  • stop_signal: The stop signal for the image. This is an optional field. stop signal section
  • volumes: The volumes for the image. This is an optional field. volumes section
note

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.