From 408ea0771a9cb3046b8e484dcfefe5233fcbb27a Mon Sep 17 00:00:00 2001 From: "Guillaume J. Charmes" Date: Thu, 13 Feb 2014 17:23:09 -0800 Subject: [PATCH] Mount-bind the PTY as container console - allow for tmux/screen to run Docker-DCO-1.1-Signed-off-by: Guillaume J. Charmes (github: creack) --- container.go | 1 + execdriver/driver.go | 2 ++ execdriver/lxc/lxc_template.go | 4 ++++ 3 files changed, 7 insertions(+) diff --git a/container.go b/container.go index b3c139269b..af28689810 100644 --- a/container.go +++ b/container.go @@ -231,6 +231,7 @@ func (container *Container) setupPty() error { container.ptyMaster = ptyMaster container.command.Stdout = ptySlave container.command.Stderr = ptySlave + container.command.Console = ptySlave.Name() // Copy the PTYs to our broadcasters go func() { diff --git a/execdriver/driver.go b/execdriver/driver.go index 1ea086075d..32b39771b6 100644 --- a/execdriver/driver.go +++ b/execdriver/driver.go @@ -99,6 +99,8 @@ type Command struct { Network *Network `json:"network"` // if network is nil then networking is disabled Config []string `json:"config"` // generic values that specific drivers can consume Resources *Resources `json:"resources"` + + Console string `json:"-"` } // Return the pid of the process diff --git a/execdriver/lxc/lxc_template.go b/execdriver/lxc/lxc_template.go index a89365f989..639780f5d8 100644 --- a/execdriver/lxc/lxc_template.go +++ b/execdriver/lxc/lxc_template.go @@ -80,6 +80,10 @@ lxc.mount.entry = proc {{escapeFstabSpaces $ROOTFS}}/proc proc nosuid,nodev,noex # if your userspace allows it. eg. see http://bit.ly/T9CkqJ lxc.mount.entry = sysfs {{escapeFstabSpaces $ROOTFS}}/sys sysfs nosuid,nodev,noexec 0 0 +{{if .Tty}} +lxc.mount.entry = {{.Console}} {{escapeFstabSpaces $ROOTFS}}/dev/console none bind,rw 0 0 +{{end}} + lxc.mount.entry = devpts {{escapeFstabSpaces $ROOTFS}}/dev/pts devpts newinstance,ptmxmode=0666,nosuid,noexec 0 0 lxc.mount.entry = shm {{escapeFstabSpaces $ROOTFS}}/dev/shm tmpfs size=65536k,nosuid,nodev,noexec 0 0