Reputation: 13962
I found that -
By default, when no option is provided to the
docker run
command, the root process is started in the foreground. This means that the standard input, output, and error from the root process are attached to the terminal session.
So, what is the difference between $ docker container run -ait ubuntu
& $ docker container run -it ubuntu
?
When to use --attach
with docker container run
?
Upvotes: 3
Views: 1891
Reputation: 11243
If you do not specify -a then Docker will attach to both stdout and stderr when running in foreground mode. You can use --attach
option to attach to specific streams instead.
-a=[] : Attach to `STDIN`, `STDOUT` and/or `STDERR`
docker run -a stdin -a stdout -i -t ubuntu /bin/bash
Upvotes: 3