Docker driver options

Docker driver options specification

The following table describes the attributes that can be configured on the Docker driver.

Keywords reference for Docker driver

KeywordTypeDescriptionValue
contextmapIt is the Docker build context. There you find the set of files required to build a Docker image. The context cam be located either on a local path, known as path context, or in a git respository, named git context.
mandatory
Each context type has its own specifications.
Refer to the Docker build contexts section for a detailed description of how to configure each context
dockerfilestringDockerfiles’s location path. The path is relative to context root
optional
By default, is used the Dockerfile located at context root

Docker build contexts

Stevedore supports two kinds of Docker build context. The path context, which uses a local folder to create the Docker build context, and the git context, which creates the Docker build context from a git repository.

Path context

KeywordTypeDescriptionValue
pathstringIt specifies where to find the files required to build the image
mandatory
-

Git context

KeywordTypeDescriptionValue
gitmapIt is the keyword under which are defined the git repository details
mandatory
-
repositorystringRepository specifies the git repository to find the files to build the image. repository keyword is placed under git.
mandatory
-
referencestringRepository reference required to build the image. reference keyword is placed under git.
optional
By default, is used refs/heads/master reference, that belongs to go-git project.

Variables-mapping reference

Docker driver passes variables mapping to Docker API as build arguments and each variable can be consumed as an ARG inside the Dockerfile definition.

Key nameDescriptionDefault
argument-name
Default
argument-value
image_from_name_keyThis is the argument-name that you can use to set the name of the base image that you want to use as a starting point for your Docker imageimage_from_nameThe argument-value is set as the parent image’s name within the images-tree
image_from_registry_host_keyThis is the argument-name that you can use to set the Docker registry host where the base image is locatedimage_from_registry_hostThe argument-value is set as the parent image’s registry host within the images-tree
image_from_registry_namespace_keyThis is the argument-name that you can use to set the namespace of the Docker registry where the base image is locatedimage_from_registry_namespaceThe argument-value is set as the parent image’s namespace within the images-tree
image_from_tag_keyThis is the argument-name that you can use to set the tag of the base image that you want to use as a starting point for your Docker imageimage_from_tagThe argument-value is set as the parent image’s version within the images-tree

The example below defines a Dockerfile that can use the arguments passed by the docker driver to build a Docker image.

1
2
3
4
5
6
ARG image_from_registry_host
ARG image_from_registry_namespace
ARG image_from_name
ARG image_from_tag
FROM ${image_from_registry_host}/${image_from_registry_namespace}/${image_from_name}:${image_from_tag}
RUN <set-your-action>

Last modified March 26, 2023: change header image (ef70c3b)