diff options
author | Giuseppe Scrivano <gscrivan@redhat.com> | 2019-01-11 11:51:21 +0100 |
---|---|---|
committer | Matthew Heon <matthew.heon@pm.me> | 2019-02-08 15:02:28 -0500 |
commit | b478f42656115eb83ff42a4a65afc10ec8864ae4 (patch) | |
tree | 79014cf90762f8b70c052380cb7b504aaf7e8a53 /cmd | |
parent | 550d39c3e9602096e456172f6d89eaa04712c1fa (diff) | |
download | podman-b478f42656115eb83ff42a4a65afc10ec8864ae4.tar.gz podman-b478f42656115eb83ff42a4a65afc10ec8864ae4.tar.bz2 podman-b478f42656115eb83ff42a4a65afc10ec8864ae4.zip |
rootless: join both userns and mount namespace with --pod
When --pod is specified then join both the user and mount namespace
for the pod so we can initialize the storage.
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
Diffstat (limited to 'cmd')
-rw-r--r-- | cmd/podman/create.go | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/cmd/podman/create.go b/cmd/podman/create.go index a66603360..8c45b568a 100644 --- a/cmd/podman/create.go +++ b/cmd/podman/create.go @@ -5,6 +5,7 @@ import ( "encoding/json" "fmt" "io" + "io/ioutil" "os" "path/filepath" "strconv" @@ -809,11 +810,15 @@ func joinOrCreateRootlessUserNamespace(createConfig *cc.CreateConfig, runtime *l if s != libpod.ContainerStateRunning && s != libpod.ContainerStatePaused { continue } - pid, err := prevCtr.PID() + data, err := ioutil.ReadFile(prevCtr.Config().ConmonPidFile) if err != nil { - return false, -1, err + return false, -1, errors.Wrapf(err, "cannot read conmon PID file %q", prevCtr.Config().ConmonPidFile) } - return rootless.JoinNS(uint(pid)) + conmonPid, err := strconv.Atoi(string(data)) + if err != nil { + return false, -1, errors.Wrapf(err, "cannot parse PID %q", data) + } + return rootless.JoinDirectUserAndMountNS(uint(conmonPid)) } } |