3

I was just going through Docker run documentation and came across the following command:

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

The documentation can be found HERE.

can somebody tell me, is the stdin and stdout stand for ?

I found this thread HERE, but its related to python , can anybody explain this to me in the context of Docker and ofcourse ubuntu ?

Thank you.

1 Answer 1

7

In general they are same as what you have mentioned and read in reference links for python. streams for receiving or reading input (stdin) and printing output (stdout). Example input from the keyboard or printing output to unix terminal. one reference here.

By default docker attaches all streams to docker container (in foreground mode). If you choose to override say, in below command I only attach stdout

docker run -a stdout -i -t centos /bin/bash 

This will only attach to stdout and hence I will not be able to type anything on this terminal, but could see print(input and output) from other terminal session of docker container (example when we login to docker container using command : docker attach <container-id>).

Sign up to request clarification or add additional context in comments.

1 Comment

+1 for pointing out that the default is to attach all streams. This wasn't clear to me at all from the documentation so I kept wondering why I was able to interact with the containers and get output without including -a flag.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.