docker run -it centos - (temporary)
Creates a docker container with Centos installed temporarily
If you exit and come back the container will be stopped
You would need to restart the container
- it is for an interactive session
t is for tty
A tty is a text input output environment (shell).
The -it flag gives you an interactive tty to the docker container. It is as if you are inside the shell for the docker container.
The stdout for the docker container is piped to your current shell and your input is piped to the docker container.
In linux when you run a command, you need a terminal (tty) to execute it.
When you want to connect to docker or run a command in a docker container you have to provide the option -t provides the terminal inside of the docker container.