HomeDocs
DocsCommunityTestimonialsUsersGitHubTwitterBlogJobsTermsPrivacyCookies
TermsPrivacyCookies
Hey! These docs are for version 2.8, which is no longer officially supported. Click here for the latest version, 2.15!


Options for interacting with Docker.

Config section: <span style="color: purple"><code>[docker]</code></span>

## Basic options

<div style="color: purple"> <h3><code>registries</code></h3> <code>--docker-registries=&quot;{'key1': val1, 'key2': val2, ...}&quot;</code><br> <code>PANTS_DOCKER_REGISTRIES</code><br> </div> <div style="padding-left: 2em;"> <span style="color: green">default: <code>{}</code></span>

<br>

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



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"`.

</div> <br>

<div style="color: purple"> <h3><code>default_repository</code></h3> <code>--docker-default-repository=&lt;str&gt;</code><br> <code>PANTS_DOCKER_DEFAULT_REPOSITORY</code><br> </div> <div style="padding-left: 2em;"> <span style="color: green">default: <code>{name}</code></span>

<br>

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.

</div> <br>

<div style="color: purple"> <h3><code>build_args</code></h3> <code>--docker-build-args=&quot;['&lt;str&gt;', '&lt;str&gt;', ...]&quot;</code><br> <code>PANTS_DOCKER_BUILD_ARGS</code><br> </div> <div style="padding-left: 2em;"> <span style="color: green">default: <code>[]</code></span>

<br>

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.

</div> <br>

## Advanced options

<div style="color: purple"> <h3><code>env_vars</code></h3> <code>--docker-env-vars=&quot;['&lt;str&gt;', '&lt;str&gt;', ...]&quot;</code><br> <code>PANTS_DOCKER_ENV_VARS</code><br> </div> <div style="padding-left: 2em;"> <span style="color: green">default: <code>[]</code></span>

<br>

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.

</div> <br>

## Deprecated options

None