Closed
Description
Is your feature request related to a problem? Please describe.
Docker compose outputs container stderr output to stdout
Refer to the sample below:
docker-compose.yml :
version: "3.3"
services:
stderr:
image: alpine
command: /bin/ash /log_to_stderr.sh
volumes:
- ./log_to_stderr.sh:/log_to_stderr.sh
log_to_stderr.sh:
>&2 echo "log to stderr"
echo "log to stdout"
Running the bash script separately we get the output:
❯ ./log_to_stderr.sh 2> /dev/null
log to stdout
BUT
when running docker-compose we get:
❯ docker-compose up 2> /dev/null
Attaching to composeissue_stderr_1
stderr_1 | log to stderr
stderr_1 | log to stdout
composeissue_stderr_1 exited with code 0
Note:
Just running the image with docker seems to give us the expected behaviour:
❯ docker run --rm -v ${PWD}/log_to_stderr.sh:/log_to_stderr.sh alpine /bin/ash /log_to_stderr.sh 2> /dev/null
log to stdout
Describe the solution you'd like
Docker compose should use the same output stream as the container.