Skip to content

Instantly share code, notes, and snippets.

@YumaInaura

YumaInaura/README.md

Last active Jul 31, 2018
Embed
What would you like to do?
Docker —Using docker run with interactive mode but without tty ( What happens? )

Docker — Using docker run with interactive mode but without tty ( What happens? )

Usually we into docker container with docker run command option like -it. But if not specified -t, what happens?

In the first place, what is tty?

$ docker run --help | grep tty
  -t, --tty                            Allocate a pseudo-TTY

Umm i don’t understand that enough, yet.

Pseudoterminal - Wikipedia

Trying

docker run --interactive alpine

No PRONPT mark

At first, you will find, console has no PRONPT mark. ( e.g # $ ) Console freezing? No you are already in the docker container's control.

Control arrow keys

You can not handle arrow keys well.

^[[C^[[C^[[C
/bin/sh:    : not found

In this case, it seems execute commands as control character ( But probably terminal does not output them ).

Execute commands

But you can execute commands without --tty.

echo

echo Alice
Alice
echo Bob
Bob

ls

ls var/lib

apk
misc
udhcpd

exit

exit

Conclusion

On docker interactive mode without tty device, you can execute commands, but it does not behave well as terminal.

Links

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment