Skip to content

Commit

Permalink
Merge pull request containerd#1894 from thaJeztah/refactor_withBindMo…
Browse files Browse the repository at this point in the history
…untHostIPC

cmd/nerdctl: withBindMountHostIPC: slight refactor
  • Loading branch information
AkihiroSuda authored Jan 21, 2023
2 parents b91a717 + 0088e84 commit a038f2d
Showing 1 changed file with 5 additions and 14 deletions.
19 changes: 5 additions & 14 deletions cmd/nerdctl/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -901,23 +901,14 @@ func generateRootfsOpts(ctx context.Context, client *containerd.Client, platform
// Required for --ipc=host on rootless.
func withBindMountHostIPC(_ context.Context, _ oci.Client, _ *containers.Container, s *oci.Spec) error {
for i, m := range s.Mounts {
if path.Clean(m.Destination) == "/dev/shm" {
newM := specs.Mount{
Destination: "/dev/shm",
switch p := path.Clean(m.Destination); p {
case "/dev/shm", "/dev/mqueue":
s.Mounts[i] = specs.Mount{
Destination: p,
Type: "bind",
Source: "/dev/shm",
Source: p,
Options: []string{"rbind", "nosuid", "noexec", "nodev"},
}
s.Mounts[i] = newM
}
if path.Clean(m.Destination) == "/dev/mqueue" {
newM := specs.Mount{
Destination: "/dev/mqueue",
Type: "bind",
Source: "/dev/mqueue",
Options: []string{"rbind", "nosuid", "noexec", "nodev"},
}
s.Mounts[i] = newM
}
}
return nil
Expand Down

0 comments on commit a038f2d

Please sign in to comment.