4

I am reading the spec of the run command and see the following:

-i : Keep STDIN open even if not attached

and

-a=[] : Attach to STDIN, STDOUT and/or STDERR

and

You can specify to which of the three standard streams (STDIN, STDOUT, STDERR) you’d like to connect

But I lack of understanding: what does it mean to "connect a container to a standard stream?" Can somebody explain? What does for example the -i parameter do?

2 Answers 2

10

Well, STDIN (Standard Input), STDOUT (Standard Output), STDERR (Standard Error) are three standard stream.

Normally, STDIN means keyboard, STDOUT and STDERR mean the direct screen display.

So, if you want to give your container some input from keyboard, you need to connect it to the STDIN. And if you want your container print the result on the screen, you may need to connect it to STDOUT and STDERR.

Otherwise, your container can run in the background. Input may come from, say, network and output may be stored in a log file.

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

1 Comment

And can you tell, what does it mean to "keep STDIN open" ? And what does it mean to bea "attached" ni this context? Why does it influence the stream STDIN ?
1

if you want to execute any command on running container tty you need to attach a standard stream for input, output or error (STDIN, STDOUT, STDERR).

So you can keep the tty intractive using -i command even if stream is not attached.

or can directly execute attach using -it {running container id} /bin/bash

2 Comments

But what does this mean for people can keep the tty intractive .. if stream is not attached What can I do, when the tty is interactive and no stream is attached? What changes when tty is interactive and the stream is attached ? tty interactive means - I can pass commands to container via exec, and it will be redirected to the container tty?
yuppp, you are right.... tty interactive means - I can pass commands to container via exec, and it will be redirected to the container tty. and it keeps tty interactive so you can pass multiple command and execute it on container's tty.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.