Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Docker: execute a program that requires tty

Tags:

docker

tty

I have a utility program that depends on terminal characteristics. I want to execute it inside a docker container. (the program is not a interactive program as such. It is an old program that was written that way).

docker run -i -t or docker exec -i -t should open a tty into container. But here is what happens..

user@1755e1f3f735:~/region/primer/cobol_v> kickstop
[Error] Unable to run without terminal device (tty)
user@1755e1f3f735:~/region/primer/cobol_v> tty
not a tty

When -t option to docker command (run/exec) should give a 'tty', the tty commands returns with 'not a tty'. This is puzzling.

I experienced this on a openSuse and fedora23 hosts and images, if that matters. I used 'guake', MATE (Gnome?) terminal emulators for this, with same results.

Is there any solution to this? or this is by design and have to replace/rewrite my utility?

like image 464
yogmk Avatar asked Nov 09 '22 18:11

yogmk


1 Answers

I ran into the same issue, and found "docker exec -ti container script /dev/null" solved the problem.

After login to the container with the above command, I can use screen normally.

Reference: https://github.com/docker/docker/issues/8755

like image 134
bob Avatar answered Nov 15 '22 06:11

bob