summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--cmd/podman/create.go2
-rw-r--r--docs/podman-create.1.md1
-rw-r--r--docs/podman-run.1.md1
-rw-r--r--pkg/spec/spec.go3
4 files changed, 6 insertions, 1 deletions
diff --git a/cmd/podman/create.go b/cmd/podman/create.go
index d5390194c..cf0020ffb 100644
--- a/cmd/podman/create.go
+++ b/cmd/podman/create.go
@@ -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"))
diff --git a/docs/podman-create.1.md b/docs/podman-create.1.md
index 3e401e47b..293cabf68 100644
--- a/docs/podman-create.1.md
+++ b/docs/podman-create.1.md
@@ -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]]*]
diff --git a/docs/podman-run.1.md b/docs/podman-run.1.md
index c4fe25675..bd1a5d56f 100644
--- a/docs/podman-run.1.md
+++ b/docs/podman-run.1.md
@@ -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.
diff --git a/pkg/spec/spec.go b/pkg/spec/spec.go
index 2300d268a..4b6b947d7 100644
--- a/pkg/spec/spec.go
+++ b/pkg/spec/spec.go
@@ -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)
}