From 6089e679a2fb2494fd3e599a9eab9327e6a509fc Mon Sep 17 00:00:00 2001 From: Alex Samorukov Date: Sat, 2 May 2015 01:42:53 +0200 Subject: [PATCH] Make LXC exec driver compatible with recent LXC where lxc.autodev is enabled by default Update LXC to 1.1.2 Signed-off-by: Alex Samorukov --- Dockerfile | 2 +- daemon/execdriver/lxc/lxc_template.go | 9 ++++++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/Dockerfile b/Dockerfile index bbefb47afb..4bb35b857c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -69,7 +69,7 @@ RUN cd /usr/local/lvm2 \ # see https://git.fedorahosted.org/cgit/lvm2.git/tree/INSTALL # Install lxc -ENV LXC_VERSION 1.0.7 +ENV LXC_VERSION 1.1.2 RUN mkdir -p /usr/src/lxc \ && curl -sSL https://linuxcontainers.org/downloads/lxc/lxc-${LXC_VERSION}.tar.gz | tar -v -C /usr/src/lxc/ -xz --strip-components=1 RUN cd /usr/src/lxc \ diff --git a/daemon/execdriver/lxc/lxc_template.go b/daemon/execdriver/lxc/lxc_template.go index 6bb50e6ab1..816d237553 100644 --- a/daemon/execdriver/lxc/lxc_template.go +++ b/daemon/execdriver/lxc/lxc_template.go @@ -46,6 +46,9 @@ lxc.cgroup.devices.allow = {{$allowedDevice.CgroupString}} # Use mnt.putold as per https://bugs.launchpad.net/ubuntu/+source/lxc/+bug/986385 lxc.pivotdir = lxc_putold +# lxc.autodev is not compativle with lxc --device switch +lxc.autodev = 0 + # NOTICE: These mounts must be applied within the namespace {{if .ProcessConfig.Privileged}} # WARNING: mounting procfs and/or sysfs read-write is a known attack vector. @@ -67,11 +70,11 @@ lxc.aa_profile = {{.AppArmorProfile}} {{end}} {{if .ProcessConfig.Tty}} -lxc.mount.entry = {{.ProcessConfig.Console}} {{escapeFstabSpaces $ROOTFS}}/dev/console none bind,rw 0 0 +lxc.mount.entry = {{.ProcessConfig.Console}} {{escapeFstabSpaces $ROOTFS}}/dev/console none bind,rw,create=file 0 0 {{end}} -lxc.mount.entry = devpts {{escapeFstabSpaces $ROOTFS}}/dev/pts devpts {{formatMountLabel "newinstance,ptmxmode=0666,nosuid,noexec" ""}} 0 0 -lxc.mount.entry = shm {{escapeFstabSpaces $ROOTFS}}/dev/shm tmpfs {{formatMountLabel "size=65536k,nosuid,nodev,noexec" ""}} 0 0 +lxc.mount.entry = devpts {{escapeFstabSpaces $ROOTFS}}/dev/pts devpts {{formatMountLabel "newinstance,ptmxmode=0666,nosuid,noexec,create=dir" ""}} 0 0 +lxc.mount.entry = shm {{escapeFstabSpaces $ROOTFS}}/dev/shm tmpfs {{formatMountLabel "size=65536k,nosuid,nodev,noexec,create=dir" ""}} 0 0 {{range $value := .Mounts}} {{$createVal := isDirectory $value.Source}}