summaryrefslogtreecommitdiff
path: root/cmd/podman/system/unshare.go
diff options
context:
space:
mode:
authorPaul Holzinger <paul.holzinger@web.de>2021-03-29 18:57:54 +0200
committerPaul Holzinger <paul.holzinger@web.de>2021-04-07 15:54:12 +0200
commit0a39ad196cf4af601b0ea32b2c0e0490c9079377 (patch)
treebb13c7343185c3c42356b16a4e9f55508ea6f786 /cmd/podman/system/unshare.go
parent0e67053b9a26f20e5ccbffdcc5e7a84254ca16b8 (diff)
downloadpodman-0a39ad196cf4af601b0ea32b2c0e0490c9079377.tar.gz
podman-0a39ad196cf4af601b0ea32b2c0e0490c9079377.tar.bz2
podman-0a39ad196cf4af601b0ea32b2c0e0490c9079377.zip
podman unshare: add --rootless-cni to join the ns
Add a new --rootless-cni option to podman unshare to also join the rootless-cni network namespace. This is useful if you want to connect to a rootless container via IP address. This is only possible from the rootless-cni namespace and not from the host namespace. This option also helps to debug problems in the rootless-cni namespace. Signed-off-by: Paul Holzinger <paul.holzinger@web.de>
Diffstat (limited to 'cmd/podman/system/unshare.go')
-rw-r--r--cmd/podman/system/unshare.go6
1 files changed, 4 insertions, 2 deletions
diff --git a/cmd/podman/system/unshare.go b/cmd/podman/system/unshare.go
index 5e6ff569b..c07751532 100644
--- a/cmd/podman/system/unshare.go
+++ b/cmd/podman/system/unshare.go
@@ -12,9 +12,10 @@ import (
)
var (
+ unshareOptions = entities.SystemUnshareOptions{}
unshareDescription = "Runs a command in a modified user namespace."
unshareCommand = &cobra.Command{
- Use: "unshare [COMMAND [ARG...]]",
+ Use: "unshare [options] [COMMAND [ARG...]]",
DisableFlagsInUseLine: true,
Short: "Run a command in a modified user namespace",
Long: unshareDescription,
@@ -33,6 +34,7 @@ func init() {
})
flags := unshareCommand.Flags()
flags.SetInterspersed(false)
+ flags.BoolVar(&unshareOptions.RootlessCNI, "rootless-cni", false, "Join the rootless network namespace used for CNI networking")
}
func unshare(cmd *cobra.Command, args []string) error {
@@ -49,5 +51,5 @@ func unshare(cmd *cobra.Command, args []string) error {
args = []string{shell}
}
- return registry.ContainerEngine().Unshare(registry.Context(), args)
+ return registry.ContainerEngine().Unshare(registry.Context(), args, unshareOptions)
}