Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

what is docker run -it flag?

People also ask

What is the docker run flag?

The docker run command provides a flag that will copy the volumes from one or more containers to the new container. The flag --volumes-from can be set multiple times to specify multiple source containers.

What does flag mean in docker?

The key here is the word "interactive". If you omit the flag, the container still executes /bin/bash but exits immediately. With the flag, the container executes /bin/bash then patiently waits for your input.

What does T flag do with docker run?

The -t (or --tty) flag tells Docker to allocate a virtual terminal session within the container. This is commonly used with the -i (or --interactive) option, which keeps STDIN open even if running in detached mode (more about that later).

What is the Run command in docker?

The docker run command is the command used to launch Docker containers. As such, it's familiar to anyone starting or running Docker containers on a daily basis.


-it is short for --interactive + --tty when you docker run with this command.. it would take you straight inside of the container,, where -d is short for --detach which means you just run the container and then detach from it so basically you run container in the background.. edit : so if you run docker container with-itd it would run the-it options and detach you from the container, so your container still running in the background even without any default app to run..


docker run -it ubuntu:xenial /bin/bash starts the container in the interactive mode (hence -it flag) that allows you to interact with /bin/bash of the container. That means now you will have bash session inside the container, so you can ls, mkdir, or do any bash command inside the container.

The key here is the word "interactive". If you omit the flag, the container still executes /bin/bash but exits immediately. With the flag, the container executes /bin/bash then patiently waits for your input.