Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What does it mean to attach a tty/std-in-out to dockers or lxc?

Tags:

docker

I read some docker docs and I do not understand what it might mean to

  • attach a tty
  • attach std-in and std-out

for these purposes, I see that -i and -t flags are use.

What does this process mean?

like image 828
Phil Avatar asked Mar 08 '14 17:03

Phil


1 Answers

stdin, stdout, and ttys are related concepts. stdin and stdout are the input and output streams of a process. A pseudo terminal (also known as a tty or a pts) connects a user's "terminal" with the stdin and stdout stream, commonly (but not necessarily) through a shell such as bash. I use quotes around "terminal" since we really don't use a terminal in the same sense today.

In the case of docker, you'll often use -t and -i together when you run processes in interactive mode, such as when starting a bash shell. In the case of the shell you want to be able to issue commands and read the output.

The code docker uses to attach stdout/stdin has all the dirty details.

like image 182
Ben Whaley Avatar answered Oct 12 '22 22:10

Ben Whaley