Was curious about this too so did some googling
A pseudo TTY is:
A pseudo TTY (or “PTY”) is a pair of devices — a slave and a master — that provide a special sort of communication channel. The slave device behaves much like the device representing the VT100 or ADM-3A “dumb terminal” that we all have on our desks … or that we might have had a few decades ago.
From: Containers, pseudo TTYs, and backward compatibility [LWN.net]
And how it relates to Docker:
The
-t
option goes to how Unix/Linux handles terminal access. In the past, a terminal was a hardline connection, later a modem based connection. These had physical device drivers (they were real pieces of equipment). Once generalized networks came into use, a pseudo-terminal driver was developed. This is because it creates a separation between understanding what terminal capabilities can be used without the need to write it into your program directly (read man pages onstty
,curses
).So, with that as background, run a container with no options and by default you have a stdout stream (so
docker run | <cmd>
works); run with-i
, and you get stdin stream added (so<cmd> | docker run -i
works); use-t
, usually in the combination-it
and you have a terminal driver added, which if you are interacting with the process is likely what you want. It basically makes the container start look like a terminal connection session.
Source: Confused about Docker -t option to Allocate a pseudo-TTY - Stack Overflow