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
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
None
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
None
A human-readable description of the target.
Use pants list --documented ::
to see all targets with descriptions.
docker_env_vars
Iterable[str] | None
None
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
None
pants.backend.docker
Overrides the default value from the option [docker].executable_search_paths
when this environment target is active.
fallback_environment
str | None
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
None
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
None
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
None
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
None
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
None
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
None
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
None
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
None
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
None
pants.backend.experimental.go
Overrides the default value from the option [golang].cgo_tool_search_paths
when this environment target is active.
golang_external_linker_binary_name
str | None
None
pants.backend.experimental.go
Overrides the default value from the option [golang].external_linker_binary_name
when this environment target is active.
golang_go_search_paths
Iterable[str] | None
None
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
None
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
None
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
None
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
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.