Skip to content

Commit

Permalink
Merge pull request containers#6484 from rhatdan/namespace
Browse files Browse the repository at this point in the history
Namespace fields were set with bogus values
  • Loading branch information
openshift-merge-robot authored Jun 4, 2020
2 parents 06d8c3d + bdfec45 commit ff99c3e
Showing 1 changed file with 15 additions and 14 deletions.
29 changes: 15 additions & 14 deletions cmd/podman/containers/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -161,24 +161,25 @@ func createInit(c *cobra.Command) error {
if c.Flag("no-hosts").Changed && c.Flag("add-host").Changed {
return errors.Errorf("--no-hosts and --add-host cannot be set together")
}
if c.Flag("userns").Changed {
cliVals.UserNS = c.Flag("userns").Value.String()
}
if c.Flag("ipc").Changed {
cliVals.IPC = c.Flag("ipc").Value.String()
}
if c.Flag("uts").Changed {
cliVals.UTS = c.Flag("uts").Value.String()
}
if c.Flag("pid").Changed {
cliVals.PID = c.Flag("pid").Value.String()
cliVals.UserNS = c.Flag("userns").Value.String()
// if user did not modify --userns flag and did turn on
// uid/gid mappsings, set userns flag to "private"
if !c.Flag("userns").Changed && cliVals.UserNS == "host" {
if len(cliVals.UIDMap) > 0 ||
len(cliVals.GIDMap) > 0 ||
cliVals.SubUIDName != "" ||
cliVals.SubGIDName != "" {
cliVals.UserNS = "private"
}
}

cliVals.IPC = c.Flag("ipc").Value.String()
cliVals.UTS = c.Flag("uts").Value.String()
cliVals.PID = c.Flag("pid").Value.String()
cliVals.CGroupsNS = c.Flag("cgroupns").Value.String()
if !c.Flag("pids-limit").Changed {
cliVals.PIDsLimit = -1
}
if c.Flag("cgroupns").Changed {
cliVals.CGroupsNS = c.Flag("cgroupns").Value.String()
}
if c.Flag("entrypoint").Changed {
val := c.Flag("entrypoint").Value.String()
cliVals.Entrypoint = &val
Expand Down

0 comments on commit ff99c3e

Please sign in to comment.