mirror of
https://github.com/containers/podman.git
synced 2025-12-08 14:48:48 +08:00
rootless, create: support --pod
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com> Closes: #1372 Approved by: mheon
This commit is contained in:
committed by
Atomic Bot
parent
8ca67d2794
commit
1ac1c54027
@@ -99,6 +99,10 @@ func createCmd(c *cli.Context) error {
|
|||||||
storageOpts.UIDMap = mappings.UIDMap
|
storageOpts.UIDMap = mappings.UIDMap
|
||||||
storageOpts.GIDMap = mappings.GIDMap
|
storageOpts.GIDMap = mappings.GIDMap
|
||||||
|
|
||||||
|
if os.Getuid() != 0 {
|
||||||
|
rootless.SetSkipStorageSetup(true)
|
||||||
|
}
|
||||||
|
|
||||||
runtime, err := libpodruntime.GetRuntimeWithStorageOpts(c, &storageOpts)
|
runtime, err := libpodruntime.GetRuntimeWithStorageOpts(c, &storageOpts)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return errors.Wrapf(err, "error creating libpod runtime")
|
return errors.Wrapf(err, "error creating libpod runtime")
|
||||||
@@ -110,7 +114,7 @@ func createCmd(c *cli.Context) error {
|
|||||||
|
|
||||||
imageName := ""
|
imageName := ""
|
||||||
var data *inspect.ImageData = nil
|
var data *inspect.ImageData = nil
|
||||||
if rootfs == "" {
|
if rootfs == "" && !rootless.SkipStorageSetup() {
|
||||||
newImage, err := runtime.ImageRuntime().New(ctx, c.Args()[0], rtc.SignaturePolicyPath, "", os.Stderr, nil, image.SigningOptions{}, false, false)
|
newImage, err := runtime.ImageRuntime().New(ctx, c.Args()[0], rtc.SignaturePolicyPath, "", os.Stderr, nil, image.SigningOptions{}, false, false)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
@@ -133,6 +137,14 @@ func createCmd(c *cli.Context) error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
became, ret, err := joinOrCreateRootlessUserNamespace(createConfig, runtime)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
if became {
|
||||||
|
os.Exit(ret)
|
||||||
|
}
|
||||||
|
|
||||||
ctr, err := runtime.NewContainer(ctx, runtimeSpec, options...)
|
ctr, err := runtime.NewContainer(ctx, runtimeSpec, options...)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ var (
|
|||||||
var cmdsNotRequiringRootless = map[string]bool{
|
var cmdsNotRequiringRootless = map[string]bool{
|
||||||
"help": true,
|
"help": true,
|
||||||
"version": true,
|
"version": true,
|
||||||
|
"create": true,
|
||||||
"exec": true,
|
"exec": true,
|
||||||
// `info` must be executed in an user namespace.
|
// `info` must be executed in an user namespace.
|
||||||
// If this change, please also update libpod.refreshRootless()
|
// If this change, please also update libpod.refreshRootless()
|
||||||
|
|||||||
Reference in New Issue
Block a user