From f82abc774a70419bc7a2ff444a323110e1d9d938 Mon Sep 17 00:00:00 2001 From: Akihiro Suda Date: Wed, 26 Aug 2020 18:07:51 +0900 Subject: rootless: support `podman network create` (CNI-in-slirp4netns) Usage: ``` $ podman network create foo $ podman run -d --name web --hostname web --network foo nginx:alpine $ podman run --rm --network foo alpine wget -O - http://web.dns.podman Connecting to web.dns.podman (10.88.4.6:80) ...

Welcome to nginx!

... ``` See contrib/rootless-cni-infra for the design. Signed-off-by: Akihiro Suda --- pkg/domain/infra/abi/network.go | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'pkg/domain/infra/abi') diff --git a/pkg/domain/infra/abi/network.go b/pkg/domain/infra/abi/network.go index c06714cbb..807e4b272 100644 --- a/pkg/domain/infra/abi/network.go +++ b/pkg/domain/infra/abi/network.go @@ -5,6 +5,7 @@ import ( "encoding/json" "fmt" "io/ioutil" + "os" "path/filepath" "strings" @@ -216,6 +217,9 @@ func createBridge(r *libpod.Runtime, name string, options entities.NetworkCreate if err != nil { return "", err } + if err := os.MkdirAll(network.GetCNIConfDir(runtimeConfig), 0755); err != nil { + return "", err + } cniPathName := filepath.Join(network.GetCNIConfDir(runtimeConfig), fmt.Sprintf("%s.conflist", name)) err = ioutil.WriteFile(cniPathName, b, 0644) return cniPathName, err -- cgit v1.2.3-54-g00ecf