Skip to main content
Version: 2.8 (deprecated)

docker


Options for interacting with Docker.

Backend: ``

Config section: [docker]

Basic options

build_args

--docker-build-args="['<str>', '<str>', ...]"
PANTS_DOCKER_BUILD_ARGS
pants.toml
[docker]
build_args = [
'<str>',
'<str>',
...,
]
default: []

Global build arguments (--build-arg) to use for all docker build invocations. Entries are either strings in the form ARG_NAME=value to set an explicit value; or just ARG_NAME to copy the value from Pants's own environment.

May be provided multiple times on the command line.

Use the extra_build_args field on a docker_image target for additional image specific build arguments.

default_repository

--docker-default-repository=<str>
PANTS_DOCKER_DEFAULT_REPOSITORY
pants.toml
[docker]
default_repository = <str>
default: {name}

Configure the default repository name used in the Docker image tag.

The value is formatted and may reference these variables:

  • name
  • directory
  • parent_directory

Example: --default-repository="{directory}/{name}".

The name variable is the docker_image's target name, directory and parent_directory are the name of the directory in which the BUILD file is for the target, and its parent directory respectively.

Use the repository field to set this value directly on a docker_image target. Any registries or tags are added to the image name as required, and should not be part of the repository name.

registries

--docker-registries="{'key1': val1, 'key2': val2, ...}"
PANTS_DOCKER_REGISTRIES
pants.toml
[docker.registries]
key1 = val1
key2 = val2
...
default: {}

Configure Docker registries. The schema for a registry entry is as follows:

{
"registry-alias": {
"address": "registry-domain:port",
"default": bool,
},
...
}

If no registries are provided in a docker_image target, then all default addresses will be used, if any. The docker_image.registries may be provided with a list of registry addresses and registry aliases prefixed with @ to be used instead of the defaults. A configured registry is marked as default either by setting default = true or with an alias of "default".

Advanced options

env_vars

--docker-env-vars="['<str>', '<str>', ...]"
PANTS_DOCKER_ENV_VARS
pants.toml
[docker]
env_vars = [
'<str>',
'<str>',
...,
]
default: []

Environment variables to set for docker invocations. Entries are either strings in the form ENV_VAR=value to set an explicit value; or just ENV_VAR to copy the value from Pants's own environment.

Deprecated options

None

None