4

I am very new to Docker and also to Unix/Linux world. I have been using docker to build my images and spin up some containers and do understand the concept of containerization fairly well. However, sometimes I do see some people spinning up containers using flags like :

docker run -i -t imagename

I tried to understand the value of it and came across docker documentation here : https://docs.docker.com/v1.13/engine/reference/run/

and it has some very arcane explainations like

-i: Keep STDIN open even if not attached

-t: Allocate a pseudo-tty

what does it even mean?

Lost
  • 12,007
  • 32
  • 121
  • 193

1 Answers1

3

https://docs.docker.com/engine/reference/run/#foreground

-a=[] : Attach to STDIN, STDOUT and/or STDERR
-t : Allocate a pseudo-tty
--sig-proxy=true: Proxy all received signals to the process (non-TTY mode only)
-i : Keep STDIN open even if not attached

If you do not specify -a then Docker will attach to both stdout and stderr . You can specify to which of the three standard streams (STDIN, STDOUT, STDERR) you’d like to connect instead, as in:

$ docker run -a stdin -a stdout -i -t ubuntu /bin/bash

For interactive processes (like a shell), you must use -i -t together in order to allocate a tty for the container process.
-i -t is often written -it as you’ll see in later examples.
Specifying -t is forbidden when the client is receiving its standard input from a pipe.

fly2matrix
  • 2,351
  • 12
  • 13