If I run a command using docker's exec command, like so:
docker exec container gulp
It simply runs the command, but nothing is outputted to my terminal window.
However, if I actually go into the container and run the command manually:
docker exec -ti container bash
gulp
I see gulp's output:
[13:49:57] Using gulpfile ~/code/services/app/gulpfile.js
[13:49:57] Starting 'scripts'...
[13:49:57] Starting 'styles'...
[13:49:58] Starting 'emailStyles'...
...
How can I run my first command and still have the output sent to my terminal window?
Side note: I see the same behavior with npm install
s, forever restart
s, etc. So, it is not just a gulp issue, but likely something with how docker is mapping the stdout.
How can I run my first command and still have the output sent to my terminal window?
You need to make sure docker run
is launched with the -t
option in order to allocate a pseudo tty.
Then a docker exec
without -t
would still work.
I discuss docker exec -it
here, which references "Fixing the Docker TERM variable issue ")
docker@machine:/c/Users/vonc/prog$ d run --name test -dit busybox
2b06a0ebb573e936c9fa2be7e79f1a7729baee6bfffb4b2cbf36e818b1da7349
docker@machine:/c/Users/vonc/prog$ d exec test echo ok
ok
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With