aboutsummaryrefslogtreecommitdiff
path: root/libpod/oci_linux.go
diff options
context:
space:
mode:
authorGabi Beyer <gabrielle.n.beyer@intel.com>2019-06-12 17:31:18 +0000
committergabi beyer <gabrielle.n.beyer@intel.com>2019-07-30 23:28:52 +0000
commit80dcd4bebcdc8e280f6b43228561d09c194c328b (patch)
tree8cbea1af853ef8d095e35f7f5831d2609c3d24e4 /libpod/oci_linux.go
parentef8834aeab8df79452709c13ffbd0041e7cf7e81 (diff)
downloadpodman-80dcd4bebcdc8e280f6b43228561d09c194c328b.tar.gz
podman-80dcd4bebcdc8e280f6b43228561d09c194c328b.tar.bz2
podman-80dcd4bebcdc8e280f6b43228561d09c194c328b.zip
rootless: Rearrange setup of rootless containers
In order to run Podman with VM-based runtimes unprivileged, the network must be set up prior to the container creation. Therefore this commit modifies Podman to run rootless containers by: 1. create a network namespace 2. pass the netns persistent mount path to the slirp4netns to create the tap inferface 3. pass the netns path to the OCI spec, so the runtime can enter the netns Closes #2897 Signed-off-by: Gabi Beyer <gabrielle.n.beyer@intel.com>
Diffstat (limited to 'libpod/oci_linux.go')
-rw-r--r--libpod/oci_linux.go8
1 files changed, 8 insertions, 0 deletions
diff --git a/libpod/oci_linux.go b/libpod/oci_linux.go
index 45365203e..4d8e36516 100644
--- a/libpod/oci_linux.go
+++ b/libpod/oci_linux.go
@@ -405,6 +405,14 @@ func (r *OCIRuntime) stopContainer(ctr *Container, timeout uint) error {
stopSignal = uint(syscall.SIGTERM)
}
+ defer func() {
+ // cleanup container networking
+ err = ctr.cleanupNetwork()
+ if err != nil {
+ logrus.Errorf("Error cleaning up container: %s network: %v", ctr.ID(), err)
+ }
+ }()
+
if timeout > 0 {
if err := r.killContainer(ctr, stopSignal); err != nil {
// Is the container gone?