From 4c0f535f69ce954b9ca6d172b194880ee1e95836 Mon Sep 17 00:00:00 2001 From: Alexander Larsson Date: Wed, 7 May 2014 15:08:52 +0200 Subject: [PATCH] Always mount a /run tmpfs in the container All modern distros set up /run to be a tmpfs, see for instance: https://wiki.debian.org/ReleaseGoals/RunDirectory Its a very useful place to store pid-files, sockets and other things that only live at runtime and that should not be stored in the image. This is also useful when running systemd inside a container, as it will try to mount /run if not already mounted, which will fail for non-privileged container. Docker-DCO-1.1-Signed-off-by: Alexander Larsson (github: alexlarsson) --- mount/init.go | 1 + 1 file changed, 1 insertion(+) diff --git a/mount/init.go b/mount/init.go index 4d11cc81..12f833a9 100644 --- a/mount/init.go +++ b/mount/init.go @@ -156,6 +156,7 @@ func newSystemMounts(rootfs, mountLabel string, mounts libcontainer.Mounts) []mo {source: "sysfs", path: filepath.Join(rootfs, "sys"), device: "sysfs", flags: defaultMountFlags}, {source: "shm", path: filepath.Join(rootfs, "dev", "shm"), device: "tmpfs", flags: defaultMountFlags, data: label.FormatMountLabel("mode=1777,size=65536k", mountLabel)}, {source: "devpts", path: filepath.Join(rootfs, "dev", "pts"), device: "devpts", flags: syscall.MS_NOSUID | syscall.MS_NOEXEC, data: label.FormatMountLabel("newinstance,ptmxmode=0666,mode=620,gid=5", mountLabel)}, + {source: "tmpfs", path: filepath.Join(rootfs, "run"), device: "tmpfs", flags: defaultMountFlags}, } if len(mounts.OfType("devtmpfs")) == 1 {