Skip to content

Commit becc793

Browse files
AlexhuszaghEmilgardis
authored andcommitted
Fix SELinux labels to allow shared use.
Ensure that the volumes are not mounted as private, unshared volumes since we might mount with the host filesystem. This also fixes permissions issues with reading data from a mounted volume using a rootless container engine. (cherry picked from commit ee3c972)
1 parent fe365e6 commit becc793

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

src/docker/local.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -39,29 +39,29 @@ pub(crate) fn run(
3939
docker_user_id(&mut docker, engine.kind);
4040

4141
docker
42-
.args(&["-v", &format!("{}:/xargo:Z", dirs.xargo.to_utf8()?)])
43-
.args(&["-v", &format!("{}:/cargo:Z", dirs.cargo.to_utf8()?)])
42+
.args(&["-v", &format!("{}:/xargo:z", dirs.xargo.to_utf8()?)])
43+
.args(&["-v", &format!("{}:/cargo:z", dirs.cargo.to_utf8()?)])
4444
// Prevent `bin` from being mounted inside the Docker container.
4545
.args(&["-v", "/cargo/bin"]);
4646
if mount_volumes {
4747
docker.args(&[
4848
"-v",
49-
&format!("{}:{}:Z", dirs.host_root.to_utf8()?, dirs.mount_root),
49+
&format!("{}:{}:z", dirs.host_root.to_utf8()?, dirs.mount_root),
5050
]);
5151
} else {
52-
docker.args(&["-v", &format!("{}:/project:Z", dirs.host_root.to_utf8()?)]);
52+
docker.args(&["-v", &format!("{}:/project:z", dirs.host_root.to_utf8()?)]);
5353
}
5454
docker
55-
.args(&["-v", &format!("{}:/rust:Z,ro", dirs.sysroot.to_utf8()?)])
56-
.args(&["-v", &format!("{}:/target:Z", dirs.target.to_utf8()?)]);
55+
.args(&["-v", &format!("{}:/rust:z,ro", dirs.sysroot.to_utf8()?)])
56+
.args(&["-v", &format!("{}:/target:z", dirs.target.to_utf8()?)]);
5757
docker_cwd(&mut docker, &paths, mount_volumes)?;
5858

5959
// When running inside NixOS or using Nix packaging we need to add the Nix
6060
// Store to the running container so it can load the needed binaries.
6161
if let Some(ref nix_store) = dirs.nix_store {
6262
docker.args(&[
6363
"-v",
64-
&format!("{}:{}:Z", nix_store.to_utf8()?, nix_store.as_posix()?),
64+
&format!("{}:{}:z", nix_store.to_utf8()?, nix_store.as_posix()?),
6565
]);
6666
}
6767

0 commit comments

Comments
 (0)