diff options
author | Giuseppe Scrivano <gscrivan@redhat.com> | 2018-11-21 17:38:28 +0100 |
---|---|---|
committer | Giuseppe Scrivano <gscrivan@redhat.com> | 2018-11-27 21:10:16 +0100 |
commit | 4203df69aca13f14e43ad32a9b7ffb6cfb8c1016 (patch) | |
tree | b1d255b5b9b92fa400b1a38a99694609501e4dbf /cmd/podman | |
parent | 266c4952a89be89b1741f9fa69443f51387dd5c6 (diff) | |
download | podman-4203df69aca13f14e43ad32a9b7ffb6cfb8c1016.tar.gz podman-4203df69aca13f14e43ad32a9b7ffb6cfb8c1016.tar.bz2 podman-4203df69aca13f14e43ad32a9b7ffb6cfb8c1016.zip |
rootless: add new netmode "slirp4netns"
so that inspect reports the correct network configuration.
Closes: https://github.com/containers/libpod/issues/1453
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
Diffstat (limited to 'cmd/podman')
-rw-r--r-- | cmd/podman/common.go | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/cmd/podman/common.go b/cmd/podman/common.go index f9e746b28..c4016698a 100644 --- a/cmd/podman/common.go +++ b/cmd/podman/common.go @@ -11,6 +11,7 @@ import ( "github.com/containers/buildah" "github.com/containers/libpod/libpod" + "github.com/containers/libpod/pkg/rootless" "github.com/containers/storage" "github.com/fatih/camelcase" "github.com/pkg/errors" @@ -161,6 +162,13 @@ func getContext() context.Context { return context.TODO() } +func getDefaultNetwork() string { + if rootless.IsRootless() { + return "slirp4netns" + } + return "bridge" +} + // Common flags shared between commands var createFlags = []cli.Flag{ cli.StringSliceFlag{ @@ -372,7 +380,7 @@ var createFlags = []cli.Flag{ cli.StringFlag{ Name: "net, network", Usage: "Connect a container to a network", - Value: "bridge", + Value: getDefaultNetwork(), }, cli.BoolFlag{ Name: "oom-kill-disable", |