Wakan Tanka
Wakan Tanka

Reputation: 8042

specify interactive explicitly in docker run

This post nicely explains difference between detached (-d) and interactive (-i). The answer says:

-i (interactive) is about whether to keep stdin open (some programs, like bash, use stdin and other programs don't). -d (detached) is about whether the docker run command waits for the process being run to exit. Thus, they are orthogornal and not inherently contradictory. A program like bash exits when stdin in closed, so without -i, it exits immediately.

Assume that I have some command which does not require opened STDIN. Then what is the difference between using -it and not using -it? Is there any difference e.g. in following two commands?

docker run ubuntu tail -f /etc/passwd
docker run -it ubuntu tail -f /etc/passwd

Upvotes: 0

Views: 56

Answers (1)

knoppix
knoppix

Reputation: 166

Refer to the docker run command documentation

--interactive , -i  : Keep STDIN open even if not attached
--tty , -t          : Allocate a pseudo-TTY

I thought that the only difference between executing with -it or not in your case is that will runs Docker interactively and through pseudo-TTY

Upvotes: 1

Related Questions