Browse code

Mount-bind the PTY as container console - allow for tmux/screen to run

Docker-DCO-1.1-Signed-off-by: Guillaume J. Charmes <guillaume.charmes@docker.com> (github: creack)

Guillaume J. Charmes authored on 2014/02/14 10:23:09
Showing 3 changed files
... ...
@@ -231,6 +231,7 @@ func (container *Container) setupPty() error {
231 231
 	container.ptyMaster = ptyMaster
232 232
 	container.command.Stdout = ptySlave
233 233
 	container.command.Stderr = ptySlave
234
+	container.command.Console = ptySlave.Name()
234 235
 
235 236
 	// Copy the PTYs to our broadcasters
236 237
 	go func() {
... ...
@@ -99,6 +99,8 @@ type Command struct {
99 99
 	Network    *Network   `json:"network"` // if network is nil then networking is disabled
100 100
 	Config     []string   `json:"config"`  //  generic values that specific drivers can consume
101 101
 	Resources  *Resources `json:"resources"`
102
+
103
+	Console string `json:"-"`
102 104
 }
103 105
 
104 106
 // Return the pid of the process
... ...
@@ -80,6 +80,10 @@ lxc.mount.entry = proc {{escapeFstabSpaces $ROOTFS}}/proc proc nosuid,nodev,noex
80 80
 # if your userspace allows it. eg. see http://bit.ly/T9CkqJ
81 81
 lxc.mount.entry = sysfs {{escapeFstabSpaces $ROOTFS}}/sys sysfs nosuid,nodev,noexec 0 0
82 82
 
83
+{{if .Tty}}
84
+lxc.mount.entry = {{.Console}} {{escapeFstabSpaces $ROOTFS}}/dev/console none bind,rw 0 0
85
+{{end}}
86
+
83 87
 lxc.mount.entry = devpts {{escapeFstabSpaces $ROOTFS}}/dev/pts devpts newinstance,ptmxmode=0666,nosuid,noexec 0 0
84 88
 lxc.mount.entry = shm {{escapeFstabSpaces $ROOTFS}}/dev/shm tmpfs size=65536k,nosuid,nodev,noexec 0 0
85 89