-
Notifications
You must be signed in to change notification settings - Fork 18.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
pty handling issue with native driver (breaks SSH server) #4605
Comments
+1 |
Just out of curiosity, what's wrong with specifying |
Nothing wrong with To put it with different words: I would be very concerned if we had to fallback to that kind of hacks ("Let's enable |
Yep, I'm tracking now. :) |
On Tue, Mar 11, 2014 at 06:46:53PM -0700, Jérôme Petazzoni wrote:
To broaden the scope a bit, this is also an issue with 'docker build' |
How to reproduce:
|
For what it's worth, if you specify |
TL,DR: we should symlink
/dev/ptmx
to/dev/pts/ptmx
unconditionally, not only for containers with a pty.Details now.
When we start a container, we mount a new
devpts
instance on/dev/pts
.If we request a terminal (with
docker run -t …
), the native driver calls thesetupPtmx
function in nsinit/mount.go:https://github.com/dotcloud/docker/blob/master/pkg/libcontainer/nsinit/mount.go#L240
This function does two things:
/dev/ptmx
and replaces it with a symlink to/dev/pts/ptmx
;/dev/console
.If we start a container with the
-t
option, everything works fine.Now, if we do this:
-t
option... then we won't get a terminal.
SSH debug info will indicate that the
openpty()
function call failed, andstrace
will show that the SSH server tried to stat something like/dev/pts/10
instead of/dev/pts/0
.This is because when you open the
ptmx
device, the kernel identifies which instance is accessed by looking at the device on which it resides. When/dev/ptmx
is directly a character device, it resides on/dev
, which is itself on the container's rootfs, which itself is "not known" to thedevpts
system. Now, when/dev/ptmx
is a symlink to/dev/pts/ptmx
, thenptmx
actually resides on/dev/pts
, which is adevpts
filesystem and identified as such by the pty kernel code.The text was updated successfully, but these errors were encountered: