summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthew Heon <matthew.heon@gmail.com>2018-07-19 14:24:22 -0400
committerMatthew Heon <matthew.heon@gmail.com>2018-07-24 16:12:31 -0400
commit3ae0c80806b68f712756fd660d06449e71eb41b7 (patch)
treeba16d83caaecc79748cd9c594c71070991ad3b09
parent8f91678a499d29cb5221153e223f5e896cb1b5b1 (diff)
downloadpodman-3ae0c80806b68f712756fd660d06449e71eb41b7.tar.gz
podman-3ae0c80806b68f712756fd660d06449e71eb41b7.tar.bz2
podman-3ae0c80806b68f712756fd660d06449e71eb41b7.zip
Add --namespace flag to Podman
Allows joining libpod to a specific namespace when running a Podman command. Signed-off-by: Matthew Heon <matthew.heon@gmail.com>
-rw-r--r--cmd/podman/libpodruntime/runtime.go4
-rw-r--r--cmd/podman/main.go5
-rw-r--r--completions/bash/podman1
-rw-r--r--docs/podman.1.md5
-rw-r--r--libpod/options.go1
5 files changed, 15 insertions, 1 deletions
diff --git a/cmd/podman/libpodruntime/runtime.go b/cmd/podman/libpodruntime/runtime.go
index 3216d288b..9d1347cc5 100644
--- a/cmd/podman/libpodruntime/runtime.go
+++ b/cmd/podman/libpodruntime/runtime.go
@@ -88,6 +88,10 @@ func GetRuntimeWithStorageOpts(c *cli.Context, storageOpts *storage.StoreOptions
// TODO CLI flags for image config?
// TODO CLI flag for signature policy?
+ if c.GlobalIsSet("namespace") {
+ options = append(options, libpod.WithNamespace(c.GlobalString("namespace")))
+ }
+
if c.GlobalIsSet("runtime") {
options = append(options, libpod.WithOCIRuntime(c.GlobalString("runtime")))
}
diff --git a/cmd/podman/main.go b/cmd/podman/main.go
index 3dbf196c2..9ae45e056 100644
--- a/cmd/podman/main.go
+++ b/cmd/podman/main.go
@@ -173,6 +173,11 @@ func main() {
Value: "error",
},
cli.StringFlag{
+ Name: "namespace",
+ Usage: "set the libpod namespace, used create separate views of the containers and pods on the system",
+ Value: "",
+ },
+ cli.StringFlag{
Name: "root",
Usage: "path to the root directory in which data, including images, is stored",
},
diff --git a/completions/bash/podman b/completions/bash/podman
index 11203e52d..5d20bab3e 100644
--- a/completions/bash/podman
+++ b/completions/bash/podman
@@ -2224,6 +2224,7 @@ _podman_podman() {
--storage-driver
--storage-opt
--log-level
+ --namespace
"
local boolean_options="
--help -h
diff --git a/docs/podman.1.md b/docs/podman.1.md
index 5581e0569..ffc2669a4 100644
--- a/docs/podman.1.md
+++ b/docs/podman.1.md
@@ -39,6 +39,11 @@ Path to where the cpu performance results should be written
log messages above specified level: debug, info, warn, error (default), fatal or panic
+**--namespace**
+
+set namespace libpod namespace. Namespaces are used to separate groups of containers and pods in libpod's state.
+When namespace is set, created containers and pods will join the given namespace, and only containers and pods in the given namespace will be visible to Podman.
+
**--root**=**value**
Path to the root directory in which data, including images, is stored
diff --git a/libpod/options.go b/libpod/options.go
index 155c15333..7bb4a3632 100644
--- a/libpod/options.go
+++ b/libpod/options.go
@@ -285,7 +285,6 @@ func WithCNIPluginDir(dir string) RuntimeOption {
}
// WithNamespace sets the namespace for libpod.
-// Namespace is the libpod namespace to use.
// Namespaces are used to create scopes to separate containers and pods
// in the state.
// When namespace is set, libpod will only view containers and pods in