Usually we into docker container with docker run command option like -it
.
But if not specified -t
, what happens?
$ docker run --help | grep tty
-t, --tty Allocate a pseudo-TTY
Umm i don’t understand that enough, yet.
docker run --interactive alpine
At first, you will find, console has no PRONPT
mark. ( e.g #
$
)
Console freezing? No you are already in the docker container's control.
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 ).
But you can execute commands without --tty
.
echo Alice
Alice
echo Bob
Bob
ls var/lib
apk
misc
udhcpd
exit
On docker interactive mode without tty device, you can execute commands, but it does not behave well as terminal.