-
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
Interactive Shell. tty: Not a tty. Unable to use screen or tmux #728
Comments
Hmm, this is weird. I see the issue, however, docker does allocate a pty and perform a logintty on it. I'll investigate. |
Ok, thanks to @jpetazzo I understand. The shell is actually within a pty but the pty itself is outside the container, so commands like 'tty' thinks we are not within a tty. The solution would be to create the pty within the container instead of outside. In the meantime, in order to start tmux or screen, you can do as you did, use gettty, or simply start the |
For the record, it is possible to re-open stdin/stdout/stderr (with e.g. |
Thanks for the update guys. Look forward to the fix and thank you for the 'script' work around; I was looking for a command that created a pty. |
Having a similar issue with setting up an SSH server on CentOS, see: https://gist.github.com/gasi/5691565 |
I'd also like to report that this very issue prevents pacman (the ArchLinux package manager) from running properly within a docker container. pacman uses gpgme, which appears to fail because it attempts to use an ioctl on a pty it can't find, causing pacman to segfault. The above workaround by jpetazzo works brilliantly, though. So for all the other folk attempting to run ArchLinux within a docker container, run the little command above when you run a new container. |
I found this to be helpful in understanding the
at least that's the way I'm reading it. |
@jpetazzo your workaround gets screen to launch but I can't reattach to any screen. (is that what you meant by "semi-ok" ? ;-) |
I hadn't tested so far :-) The long term solution is to create the pty inside the container. |
Thanks for the hints, here is what I'm using now:
Works perfect! |
@jpetazzo Do you know a solution to run tmux? Is it a limitation from Docker and if so are there plans to change it? |
@karellm You don't like the The limitation comes from Docker as the PTY is allocated outside the container. Yes, there are plans to change it but not in a near future. It will come with long running docker init. |
When I use the |
Do you dump all the script output to disc? If you tell script to dump to /dev/null instead to |
Think it's a bug. I dump all the output to |
Fixed by #4135. |
Currently using 0.8. I have a fedora container, and have the same issues with tmux / screen. However I can't run script either: $ script while this fix isn't in an installable package, any ideas on a workaround? |
@LordCope True, the fix for this will be in 0.8.1. The fedora image may need to be updated. |
Roger that. Suggested workaround meanwhile? sudo tmux seems to suck quite hard. |
What is the status of this? It's been 2 years.. tmux still doesn't run inside docker (not a tty) Docker version 1.3.3 |
@dbabits This issue definitely is resolved. You may want to double check your image |
That is a different issue relating to |
@akerl Ok, is this a bug or not? |
@akerl Seems like the same bug replicated in a different place. Anyway, great that we cleared up the confusion. Thanks! |
I've got the same issue going on but I'm not sure the best way to work around it. If anyone has a tip that would be great. I'm launching apache via supervisor. I'm using the gnupg (pecl extension) for PHP which leverages gpgme similar to pacman mentioned above. Anytime code with the extension gets called the httpd process dies with signal 11. |
When I try to run Screen when I run an Interactive Shell, I get the following:
Although, if I create a user and getty tty, it works fine:
Screen and tmux now launch perfectly.
On the host, lxc-ps --lxc returns:
docker-admin@docker-host:~$ lxc-ps --lxc CONTAINER PID TTY TIME CMD 804c415fca9ed75a14e9e45c7e19e8712e45f9693fb8abed289960cb3d6bda32 7471 pts/1 00:00:00 bash 804c415fca9ed75a14e9e45c7e19e8712e45f9693fb8abed289960cb3d6bda32 7772 pts/1 00:00:00 login 804c415fca9ed75a14e9e45c7e19e8712e45f9693fb8abed289960cb3d6bda32 7783 pts/1 00:00:00 bash
Shouldn't docker allocate a PTY/TTY when using the -t switch to the process within the container?
The text was updated successfully, but these errors were encountered: