diff options
author | philwo <philwo@google.com> | 2018-04-27 13:14:44 -0700 |
---|---|---|
committer | Copybara-Service <copybara-piper@google.com> | 2018-04-27 13:15:52 -0700 |
commit | ff726ffa222594b9aa2b9b518ac8453763f8432a (patch) | |
tree | b1921f095cf8f908bfa784cca3462d70f513a98b /src/main/java/com/google/devtools/build/lib/sandbox/SandboxOptions.java | |
parent | aab9868f535e3a08e272570fed5fec3c51cd384b (diff) |
sandbox: Add support for running actions inside Docker containers.
RELNOTES: Bazel now supports running actions inside Docker containers.
To use this feature, run "bazel build --spawn_strategy=docker
--experimental_docker_image=myimage:latest".
PiperOrigin-RevId: 194582691
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/sandbox/SandboxOptions.java')
-rw-r--r-- | src/main/java/com/google/devtools/build/lib/sandbox/SandboxOptions.java | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/sandbox/SandboxOptions.java b/src/main/java/com/google/devtools/build/lib/sandbox/SandboxOptions.java index 6a5b79f0fc..6025944627 100644 --- a/src/main/java/com/google/devtools/build/lib/sandbox/SandboxOptions.java +++ b/src/main/java/com/google/devtools/build/lib/sandbox/SandboxOptions.java @@ -217,4 +217,52 @@ public class SandboxOptions extends OptionsBase { + "locally executed actions which use sandboxing" ) public boolean collectLocalSandboxExecutionStatistics; + + @Option( + name = "experimental_docker_image", + defaultValue = "", + documentationCategory = OptionDocumentationCategory.EXECUTION_STRATEGY, + effectTags = {OptionEffectTag.EXECUTION}, + help = + "Specify a Docker image name (e.g. \"ubuntu:latest\") that should be used to execute " + + "a sandboxed action when using the docker strategy and the action itself doesn't " + + "already have a container-image attribute in its remote_execution_properties in the " + + "platform description. The value of this flag is passed verbatim to 'docker run', so " + + "it supports the same syntax and mechanisms as Docker itself." + ) + public String dockerImage; + + @Option( + name = "experimental_docker_use_customized_images", + defaultValue = "true", + documentationCategory = OptionDocumentationCategory.EXECUTION_STRATEGY, + effectTags = {OptionEffectTag.EXECUTION}, + help = + "If enabled, injects the uid and gid of the current user into the Docker image before " + + "using it. This is required if your build / tests depend on the user having a name " + + "and home directory inside the container. This is on by default, but you can disable " + + "it in case the automatic image customization feature doesn't work in your case or " + + "you know that you don't need it." + ) + public boolean dockerUseCustomizedImages; + + @Option( + name = "experimental_docker_verbose", + defaultValue = "false", + documentationCategory = OptionDocumentationCategory.EXECUTION_STRATEGY, + effectTags = {OptionEffectTag.EXECUTION}, + help = + "If enabled, Bazel will print more verbose messages about the Docker sandbox strategy.") + public boolean dockerVerbose; + + @Option( + name = "experimental_docker_privileged", + defaultValue = "false", + documentationCategory = OptionDocumentationCategory.EXECUTION_STRATEGY, + effectTags = {OptionEffectTag.EXECUTION}, + help = + "If enabled, Bazel will pass the --privileged flag to 'docker run' when running actions. " + + "This might be required by your build, but it might also result in reduced " + + "hermeticity.") + public boolean dockerPrivileged; } |