About Docker if is executed the following command
docker run --name ubuntu-it -it ubuntu
The container named ubuntu-it, based on the ubuntu image, is created, run, is offered a tty and finally remains running. It can be stopped with the exit command. Here the importance about the it option to let have a shell available for human interaction.
For experimental purposes, if is executed the following command
docker run --name ubuntu-a ubuntu ls
The container named ubuntu-a, based on the ubuntu image, is created, run, is listed/displayed the execution of the ls command and finally the container is stopped.
If is need it re-run the ubuntu-a container is mandatory use the docker start command.
If is executed:
docker start ubuntu-a
Nothing is shown in the tty. According with the official documentation for the docker start command about its options it indicates:
-a, --attach Attach STDOUT/STDERR and forward signals
-i, --interactive Attach containerâs STDIN
Therefore if is executed:
docker start -a ubuntu-a
Is possible run again the container and the output of the ls command is listed/displayed, it because the current tty is attached with the STDOUT/STDERR stream(s) of the container. Until all is clear.
The reason of this post. If is executed (observe now is the i option):
docker start -i ubuntu-a
Is possible run again the container and the output of the ls command is listed/displayed too. Why happens this if the i option is based on the STDIN stream?