summaryrefslogtreecommitdiff
path: root/cmd
diff options
context:
space:
mode:
authorGiuseppe Scrivano <gscrivan@redhat.com>2019-01-11 11:51:21 +0100
committerGiuseppe Scrivano <gscrivan@redhat.com>2019-01-11 11:52:11 +0100
commitc4f054f102101dd198cc6e12a28510edb7849552 (patch)
tree3272d3ac1915134b0b8d66aa813a9940d1c28e64 /cmd
parentb3e7be7a0b1d5484b98bbb733ce58af84137316a (diff)
downloadpodman-c4f054f102101dd198cc6e12a28510edb7849552.tar.gz
podman-c4f054f102101dd198cc6e12a28510edb7849552.tar.bz2
podman-c4f054f102101dd198cc6e12a28510edb7849552.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.go11
1 files changed, 8 insertions, 3 deletions
diff --git a/cmd/podman/create.go b/cmd/podman/create.go
index d98b78bd4..7472426eb 100644
--- a/cmd/podman/create.go
+++ b/cmd/podman/create.go
@@ -4,6 +4,7 @@ import (
"context"
"encoding/json"
"fmt"
+ "io/ioutil"
"os"
"path/filepath"
"strconv"
@@ -785,11 +786,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))
}
}