rootless: create the userns immediately when creating a new pod
Closes: https://github.com/containers/libpod/issues/2124 Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
This commit is contained in:
parent
c4f054f102
commit
04a4ba9b73
|
|
@ -422,6 +422,16 @@ func parseCreateOpts(ctx context.Context, c *cli.Context, runtime *libpod.Runtim
|
|||
}
|
||||
if c.IsSet("pod") {
|
||||
if strings.HasPrefix(originalPodName, "new:") {
|
||||
if rootless.IsRootless() {
|
||||
// To create a new pod, we must immediately create the userns.
|
||||
became, ret, err := rootless.BecomeRootInUserNS()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if became {
|
||||
os.Exit(ret)
|
||||
}
|
||||
}
|
||||
// pod does not exist; lets make it
|
||||
var podOptions []libpod.PodCreateOption
|
||||
podOptions = append(podOptions, libpod.WithPodName(podName), libpod.WithInfraContainer(), libpod.WithPodCgroups())
|
||||
|
|
|
|||
Loading…
Reference in New Issue