Docker : ' -ti ' argument

Viewed 3781

Build an image based on the Dockerfile:

docker image build .

The result of above is

docker run --rm -ti <IMAGE_ID>

--rm : If instead you’d like Docker to automatically clean up the container and remove the file system when the container exits, you can add the --rm flag src : https://docs.docker.com/engine/reference/run/

What does the -ti argument achieve ?

3 Answers

-it is shorthand for -i -t

By Docker Run docs

-i Keep STDIN open even if not attached
-t Allocate a pseudo-tty

Which means, t for open a shell terminal (telewriter) and i listen to standard input.

It's most common way of using Docker containers, so you can actually use them to execute some of your commands.

i stands for interactive and it's accepts and responds on your input using STDIN. t is for you to have terminal - it's combined with i so you can actually put your input there.

Check more here and here.

Related