Skip to content
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

Docker 1.13.0 - Must be connected to a terminal. - screen #30421

Open
phlegx opened this Issue Jan 24, 2017 · 13 comments

Comments

Projects
None yet
8 participants
@phlegx
Copy link

phlegx commented Jan 24, 2017

I enter my docker container (docker version 1.13.0, the container was started via docker-compose version 1.8.1 ) via docker exec -it container_name bash I then install screen within my docker container and trying to run in it just by typing screen

however I then get the following error:

Must be connected to a terminal.

I remember this working just fine a while ago with an older docker version.

Is someone familiar with this problem? Could it be a bug?

@phlegx phlegx changed the title Must be connected to a terminal. - screen Docker 1.13.0 - Must be connected to a terminal. - screen Jan 24, 2017

@cpuguy83

This comment has been minimized.

Copy link
Contributor

cpuguy83 commented Jan 24, 2017

@phlegx You probably need to run the container with -t in addition to running the exec with -t.

@phlegx

This comment has been minimized.

Copy link
Author

phlegx commented Jan 25, 2017

hi @cpuguy83! Thanks and yes that is correct, it works when I run the container via docker and add there the -t flag. However I'm pretty sure that with either previous versions of docker or docker-compose this tty was enabled by default, since this worked out of the box some time ago.

I was wondering now how to model the same -t behaviour with docker-compose? I tried to set the flag tty: true (I tried this also now with the newest docker-compose version 1.10.0) as mentioned here. However this has no effect and I still get:

Must be connected to a terminal

@cpuguy83

This comment has been minimized.

Copy link
Contributor

cpuguy83 commented Jan 26, 2017

@phlegx That's indeed interesting. I believe compose does set tty by default.
Can you post the inspect output of the container created by compose which is not working with screen/exec -t?

@phlegx

This comment has been minimized.

Copy link
Author

phlegx commented Jan 30, 2017

Here is some crucial part of the the inspect:

            "Hostname": "cdf3df3fc2dd",
            "Domainname": "",
            "User": "",
            "AttachStdin": false,
            "AttachStdout": false,
            "AttachStderr": false,
            "Tty": false,
            "OpenStdin": false,
            "StdinOnce": false,
            "Env": [
...

So It seems to be still set to false even if I set:

tty: true

in the docker-compose file under the correct docker container settings.

I assume this is a bug. Do you need some more info @cpuguy83?

@amir-beheshty

This comment has been minimized.

Copy link

amir-beheshty commented Jun 6, 2017

@phlegx Has this issue been resolved? I'm dealing with the same exact issue...

@phlegx

This comment has been minimized.

Copy link
Author

phlegx commented Jun 7, 2017

@amir-beheshty Yes this issue still persists also for me.

However I came to the conclusion that its probably way better (not tested yet) to install screen on the host and run the command inside the container from there with docker exec, something like

screen docker exec -it CONTAINER_NAME sleep 10

So one does not need to install screen in the container at all and can manage everything from the host.

@amir-beheshty

This comment has been minimized.

Copy link

amir-beheshty commented Jun 7, 2017

@phlegx good idea. I just tried it:

  • sudo yum install screen
  • screen docker exec -it CONTAINER_KEY /bin/bash
    Not sure what sleep 10 is for. But so far this has worked for me. Thanks for the tip!
@wmchris

This comment has been minimized.

Copy link

wmchris commented Jun 10, 2017

Workaround:

Run "script /dev/null" to own the shell  
then try screen again.

Works like a charm for me.

@amir-beheshty

This comment has been minimized.

Copy link

amir-beheshty commented Jun 10, 2017

@wmchris Good to know, thanks!

@thaJeztah

This comment has been minimized.

Copy link
Member

thaJeztah commented Jun 13, 2017

@phlegx is this still an issue for you? I tried to reproduce using the following steps;

  1. run a container without -t / tty attached;
docker run -d --name foo nginx:alpine
  1. docker exec -it into the container
docker exec -it foo sh
  1. inside the container, install screen
/ # apk add --no-cache screen
fetch http://dl-cdn.alpinelinux.org/alpine/v3.5/main/x86_64/APKINDEX.tar.gz
fetch http://dl-cdn.alpinelinux.org/alpine/v3.5/community/x86_64/APKINDEX.tar.gz
(1/4) Installing ncurses-terminfo-base (6.0-r7)
(2/4) Installing ncurses-terminfo (6.0-r7)
(3/4) Installing ncurses-libs (6.0-r7)
(4/4) Installing screen (4.5.1-r0)
Executing busybox-1.25.1-r0.trigger
OK: 20 MiB in 30 packages
/ #
  1. start screen
/ # screen

GNU Screen version 4.05.01 (GNU) 25-Feb-17

Copyright (c) 2015-2017 Juergen Weigert, Alexander Naumov, Amadeusz Slawinski
Copyright (c) 2010-2014 Juergen Weigert, Sadrul Habib Chowdhury
Copyright (c) 2008-2009 Juergen Weigert, Michael Schroeder, Micah Cowan, Sadrul Habib Chowdhury
Copyright (c) 1993-2007 Juergen Weigert, Michael Schroeder
Copyright (c) 1987 Oliver Laumann

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3, or (at your
option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
Public License for more details.

You should have received a copy of the GNU General Public License along with this program (see the file COPYING); if not, see http://www.gnu.org/licenses/, or contact Free Software Foundation, Inc., 51
Franklin Street, Fifth Floor, Boston, MA  02111-1301  USA.

Send bugreports, fixes, enhancements, t-shirts, money, beer & pizza to screen-devel@gnu.org


Capabilities:
+copy +remote-detach +power-detach +multi-attach +multi-user +font +color-16 +utf8 -rxvt -builtin-telnet
@ryenus

This comment has been minimized.

Copy link

ryenus commented Jun 14, 2017

@thaJeztah may I ask what's your docker version? I guess most of the users are still waiting for 17.06, which as you noted would fix the tty issue, isn't it?

Update: just realized that script needs to be installed via apk add util-linux for alpine.

@thaJeztah

This comment has been minimized.

Copy link
Member

thaJeztah commented Jun 14, 2017

You're right, I forgot that machine was updated to 17.06.0-rc3. I tested in 17.05 and there the issue still occurs. Docker 17.06.0-rc3 is available for testing (but obviously not for production use yet)

@thaJeztah thaJeztah added this to the 17.06.0 milestone Jun 14, 2017

@glycerine

This comment has been minimized.

Copy link

glycerine commented Dec 9, 2017

Inside the docker container, run script /dev/null first. Then you should be able to start screen.

@thaJeztah thaJeztah removed this from the 17.06.0 milestone Jan 25, 2018

midgetspy added a commit to midgetspy/docker-rutorrent that referenced this issue Sep 17, 2018

Include util-linux to include 'script'
When using docker-compose there is no tty and thus the rtorrent screen session cannot be attached. A workaround is to execute 'script /dev/null' in the terminal so this PR includes util-linux which includes the 'script' binary.

See discussion here for more info: moby/moby#30421
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.