Skip to main content
Version: 2.15 (deprecated)

docker_environment


Configuration of a Docker environment used for building your code.

Environment configuration includes both Docker-specific information (including the image and platform choice), as well as environment-aware options (such as environment variables and search paths) used by Pants to execute processes in this Docker environment.

To use this environment, map this target's address with a memorable name in [environments-preview].names. You can then consume this environment by specifying the name in the environment field defined on other targets.

Backend: pants.core


image

str
required

The docker image ID to use when this environment is loaded.

This value may be any image identifier that the local Docker installation can accept. This includes image names with or without tags (e.g. centos6 or centos6:latest), or image names with an immutable digest (e.g. centos@sha256:<some_sha256_value>).

The choice of image ID can affect the reproducibility of builds. Consider using an immutable digest if reproducibility is needed, but regularly ensure that the image is free of relevant bugs or security vulnerabilities.

apache_thrift_thrift_search_paths

Iterable[str] | None
default: None
backend: pants.backend.codegen.thrift.apache.python

Overrides the default value from the option [apache-thrift].thrift_search_paths when this environment target is active.

description

str | None
default: None

A human-readable description of the target.

Use /home/josh/work/scie-pants/dist/pants list --documented :: to see all targets with descriptions.

docker_env_vars

Iterable[str] | None
default: None
backend: pants.backend.docker

Overrides the default value from the option [docker].env_vars when this environment target is active.

docker_executable_search_paths

Iterable[str] | None
default: None
backend: pants.backend.docker

Overrides the default value from the option [docker].executable_search_paths when this environment target is active.

fallback_environment

str | None
default: None

The environment to fallback to when this Docker environment cannot be used because either the global option --docker-execution is false, or the field platform is not compatible with the local host's CPU architecture (this is only an issue when the local host is Linux; macOS is fine).

Must be an environment name from the option [environments-preview].names, the special string __local__ to use the relevant local environment, or the Python value None to error when this specific Docker environment cannot be used.

go_generate_env_vars

Iterable[str] | None
default: None
backend: pants.backend.experimental.go

Overrides the default value from the option [go-generate].env_vars when this environment target is active.

golang_cgo_c_flags

Iterable[str] | None
default: None
backend: pants.backend.experimental.go

Overrides the default value from the option [golang].cgo_c_flags when this environment target is active.

golang_cgo_cxx_flags

Iterable[str] | None
default: None
backend: pants.backend.experimental.go

Overrides the default value from the option [golang].cgo_cxx_flags when this environment target is active.

golang_cgo_fortran_binary_name

str | None
default: None
backend: pants.backend.experimental.go

Overrides the default value from the option [golang].cgo_fortran_binary_name when this environment target is active.

golang_cgo_fortran_flags

Iterable[str] | None
default: None
backend: pants.backend.experimental.go

Overrides the default value from the option [golang].cgo_fortran_flags when this environment target is active.

golang_cgo_gcc_binary_name

str | None
default: None
backend: pants.backend.experimental.go

Overrides the default value from the option [golang].cgo_gcc_binary_name when this environment target is active.

golang_cgo_gxx_binary_name

str | None
default: None
backend: pants.backend.experimental.go

Overrides the default value from the option [golang].cgo_gxx_binary_name when this environment target is active.

golang_cgo_linker_flags

Iterable[str] | None
default: None
backend: pants.backend.experimental.go

Overrides the default value from the option [golang].cgo_linker_flags when this environment target is active.

golang_cgo_tool_search_paths

Iterable[str] | None
default: None
backend: pants.backend.experimental.go

Overrides the default value from the option [golang].cgo_tool_search_paths when this environment target is active.

golang_go_search_paths

Iterable[str] | None
default: None
backend: pants.backend.experimental.go

Overrides the default value from the option [golang].go_search_paths when this environment target is active.

golang_subprocess_env_vars

Iterable[str] | None
default: None
backend: pants.backend.experimental.go

Overrides the default value from the option [golang].subprocess_env_vars when this environment target is active.

jvm_global_options

Iterable[str] | None
default: None
backend: pants.backend.experimental.java

Overrides the default value from the option [jvm].global_options when this environment target is active.

pex_executable_search_paths

Iterable[str] | None
default: None
backend: pants.core

Overrides the default value from the option [pex].executable_search_paths when this environment target is active.

platform

'linux_arm64' | 'linux_x86_64' | 'macos_arm64' | 'macos_x86_64' | None
default: None

If set, Docker will always use the specified platform when pulling and running the image.

If unset, Pants will default to the CPU architecture of your local host machine. For example, if you are running on Apple Silicon, it will use linux_arm64, whereas running on Intel macOS will use linux_x86_64. This mirrors Docker's behavior when --platform is left off.

python_bootstrap_names

Iterable[str] | None
default: None
backend: pants.core

Overrides the default value from the option [python-bootstrap].names when this environment target is active.

python_bootstrap_search_path

Iterable[str] | None
default: None
backend: pants.core

Overrides the default value from the option [python-bootstrap].search_path when this environment target is active.

python_native_code_cpp_flags

Iterable[str] | None
default: None
backend: pants.core

Overrides the default value from the option [python-native-code].cpp_flags when this environment target is active.

python_native_code_ld_flags

Iterable[str] | None
default: None
backend: pants.core

Overrides the default value from the option [python-native-code].ld_flags when this environment target is active.

shell_setup_executable_search_path

Iterable[str] | None
default: None
backend: pants.backend.shell

Overrides the default value from the option [shell-setup].executable_search_path when this environment target is active.

subprocess_environment_env_vars

Iterable[str] | None
default: None
backend: pants.core

Overrides the default value from the option [subprocess-environment].env_vars when this environment target is active.

tags

Iterable[str] | None
default: None

Arbitrary strings to describe a target.

For example, you may tag some test targets with 'integration_test' so that you could run /home/josh/work/scie-pants/dist/pants --tag='integration_test' test :: to only run on targets with that tag.

test_extra_env_vars

Iterable[str] | None
default: None
backend: pants.core

Overrides the default value from the option [test].extra_env_vars when this environment target is active.