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.
Before running Pants using this environment, if you are using Docker Desktop, make sure the option Enable default Docker socket is enabled, you can find it in Docker Desktop Settings > Advanced panel. That option tells Docker to create a socket at /var/run/docker.sock
which Pants can use to communicate with Docker.
Backend: pants.core
image
image
type: 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
apache_thrift_thrift_search_paths
type: 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
description
type: str | None
default: None
A human-readable description of the target.
Use pants list --documented ::
to see all targets with descriptions.
docker_env_vars
docker_env_vars
type: 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
docker_executable_search_paths
type: 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
fallback_environment
type: 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
go_generate_env_vars
type: 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
golang_cgo_c_flags
type: 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
golang_cgo_cxx_flags
type: 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
golang_cgo_fortran_binary_name
type: 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
golang_cgo_fortran_flags
type: 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
golang_cgo_gcc_binary_name
type: 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
golang_cgo_gxx_binary_name
type: 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
golang_cgo_linker_flags
type: 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
golang_cgo_tool_search_paths
type: 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_external_linker_binary_name
golang_external_linker_binary_name
type: str | None
default: None
backend: 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
golang_go_search_paths
type: 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
golang_subprocess_env_vars
type: 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
jvm_global_options
type: 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.
nodejs_corepack_env_vars
nodejs_corepack_env_vars
type: Iterable[str] | None
default: None
backend: pants.backend.experimental.openapi.lint.spectral
Overrides the default value from the option [nodejs].corepack_env_vars
when this environment target is active.
nodejs_executable_search_paths
nodejs_executable_search_paths
type: Iterable[str] | None
default: None
backend: pants.backend.experimental.openapi.lint.spectral
Overrides the default value from the option [nodejs].executable_search_paths
when this environment target is active.
nodejs_search_path
nodejs_search_path
type: Iterable[str] | None
default: None
backend: pants.backend.experimental.openapi.lint.spectral
Overrides the default value from the option [nodejs].search_path
when this environment target is active.
pex_executable_search_paths
pex_executable_search_paths
type: 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
platform
type: '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
python_bootstrap_names
type: 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
python_bootstrap_search_path
type: 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
python_native_code_cpp_flags
type: 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
python_native_code_ld_flags
type: 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_paths
shell_setup_executable_search_paths
type: Iterable[str] | None
default: None
backend: pants.backend.shell
Overrides the default value from the option [shell-setup].executable_search_paths
when this environment target is active.
subprocess_environment_env_vars
subprocess_environment_env_vars
type: 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
tags
type: 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 pants --tag='integration_test' test ::
to only run on targets with that tag.
test_extra_env_vars
test_extra_env_vars
type: 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.
Updated about 1 month ago