podman: allow to specify the UTS namespace to join
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com> Closes: #1145 Approved by: rhatdan
This commit is contained in:
parent
8223fbaac6
commit
977c8a9cd6
|
|
@ -389,7 +389,7 @@ func parseCreateOpts(ctx context.Context, c *cli.Context, runtime *libpod.Runtim
|
|||
}
|
||||
|
||||
utsMode := container.UTSMode(c.String("uts"))
|
||||
if !utsMode.Valid() {
|
||||
if !cc.IsNS(string(utsMode)) && !utsMode.Valid() {
|
||||
return nil, errors.Errorf("--uts %q is not valid", c.String("uts"))
|
||||
}
|
||||
ipcMode := container.IpcMode(c.String("ipc"))
|
||||
|
|
|
|||
|
|
@ -589,6 +589,7 @@ Set the usernamespace mode for the container. The use of userns is disabled by d
|
|||
|
||||
Set the UTS mode for the container
|
||||
**host**: use the host's UTS namespace inside the container.
|
||||
**ns**: specify the usernamespace to use.
|
||||
Note: the host mode gives the container access to changing the host's hostname and is therefore considered insecure.
|
||||
|
||||
**-v**|**--volume**[=*[HOST-DIR:CONTAINER-DIR[:OPTIONS]]*]
|
||||
|
|
|
|||
|
|
@ -620,6 +620,7 @@ Set the usernamespace mode for the container. The use of userns is disabled by d
|
|||
Set the UTS mode for the container
|
||||
|
||||
`host`: use the host's UTS namespace inside the container.
|
||||
`ns`: specify the usernamespace to use.
|
||||
|
||||
**NOTE**: the host mode gives the container access to changing the host's hostname and is therefore considered insecure.
|
||||
|
||||
|
|
|
|||
|
|
@ -369,6 +369,9 @@ func addNetNS(config *CreateConfig, g *generate.Generator) error {
|
|||
|
||||
func addUTSNS(config *CreateConfig, g *generate.Generator) error {
|
||||
utsMode := config.UtsMode
|
||||
if IsNS(string(utsMode)) {
|
||||
return g.AddOrReplaceLinuxNamespace(string(spec.UTSNamespace), NS(string(utsMode)))
|
||||
}
|
||||
if utsMode.IsHost() {
|
||||
return g.RemoveLinuxNamespace(spec.UTSNamespace)
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue