Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Specify arbitrary container arguments #1315

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
docker: Handle arbitrary extra arguments
implemented in the configuration file and parsed from environment
variables.
  • Loading branch information
har7an committed Aug 21, 2023
commit a2db852b8094f6fe71006ad392bcf80d8a3c87ef
1 change: 1 addition & 0 deletions src/docker/local.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ pub(crate) fn run(

let mut docker = engine.subcommand("run");
docker.add_userns();
docker.add_extra_args(&options)?;

// Podman on macOS doesn't support selinux labels, see issue #756
#[cfg(target_os = "macos")]
Expand Down
3 changes: 3 additions & 0 deletions src/docker/remote.rs
Original file line number Diff line number Diff line change
Expand Up @@ -758,6 +758,9 @@ pub(crate) fn run(
msg_info,
)
.wrap_err("could not determine mount points")?;
docker
.add_extra_args(&options)
.wrap_err("could not determine additional container arguments")?;

docker
.add_seccomp(engine.kind, target, &paths.metadata)
Expand Down
9 changes: 9 additions & 0 deletions src/docker/shared.rs
Original file line number Diff line number Diff line change
Expand Up @@ -955,6 +955,7 @@ pub(crate) trait DockerCommandExt {
target: &Target,
metadata: &CargoMetadata,
) -> Result<()>;
fn add_extra_args(&mut self, options: &DockerOptions) -> Result<()>;
fn add_mounts(
&mut self,
options: &DockerOptions,
Expand Down Expand Up @@ -1164,6 +1165,14 @@ impl DockerCommandExt for Command {
Ok(())
}

fn add_extra_args(&mut self, options: &DockerOptions) -> Result<()> {
let extra_args = options.config.extra_args(&options.target)?;
if let Some(args) = extra_args {
self.args(args);
}
Ok(())
}

fn add_mounts(
&mut self,
options: &DockerOptions,
Expand Down