There is currently no way to prevent the up
command from producing extraneous (i.e. 'meta' messages, not produced by the service being run) output.
Supposedly --log-level
can be used to suppress unwanted output but unfortunately, this has no effect on up
(it looks like there are quite a few uses of print()
in the cli layer which of course isn't affected by log levels).
Example:
~$ docker-compose --log-level CRITICAL up service
Starting someproject_service_1 ... done
Attaching to someproject_service_1
someproject_service_1 exited with code 0
up
always produces 'meta'-output.
To have an option of preventing up
from generating meta output.
docker-compose version 1.21.2, build a133471
docker-py version: 3.3.0
CPython version: 3.6.5
OpenSSL version: OpenSSL 1.1.0g 2 Nov 2017
With this PR, you can to do,
docker-compose --log-level ERROR up -q -d
What is the state of this issue?
Looks like the Parallel "logger" doesn't respect logging level
https://github.com/docker/compose/blob/40b0ce3e5d196dd8cbc8b692be45d2a761e867b1/compose/cli/main.py#L130-L142
using --log-level ERROR
disables actual output from the command:
root@srv ~# docker-compose -f /etc/docker/docker-compose.yaml --compatibility up -d jackett
WARNING: The Docker Engine you're using is running in swarm mode.
Compose does not use swarm mode to deploy services to multiple nodes in a swarm. All containers will be scheduled on the current node.
To deploy your application across the swarm, use `docker stack deploy`.
WARNING: Found orphan containers (hass, lightswitch) for this project. If you removed or renamed this service in your compose file, you can run this command with the --remove-orphans flag to clean it up.
jackett is up-to-date
root@srv ~# docker-compose -f /etc/docker/docker-compose.yaml --log-level ERROR --compatibility up -d jackett
root@srv ~#
The warnings were correctly silenced but the output (jackett is up-to-date
) was also discarded.
My docker-compose
is not silenced:
$ docker-compose --version
docker-compose version 1.24.1, build unknown
$ docker-compose --log-level ERROR up --detach --quiet-pull 1>/dev/null
Creating curl_es_1 ... done
Creating curl_api_1 ... done
Creating curl_netcat_1 ... done
$ docker-compose --log-level ERROR down -v 1>/dev/null
Stopping curl_netcat_1 ... done
Stopping curl_es_1 ... done
Stopping curl_api_1 ... done
Removing curl_netcat_1 ... done
Removing curl_es_1 ... done
Removing curl_api_1 ... done
This makes the output of tests hard to handle and read. Is there any way this can be fixed? That would be great. Thx
restart
command can't output only errors too:
# docker-compose --log-level CRITICAL --no-ansi -f test-compose.yml restart test-service > /dev/null
Restarting compose_test-service_1 ...
Restarting compose_test-service_1 ... done
Any update on this? :-(
Hi there, shameless plug if I may: while Docker is working out how to best solve this issue, I came up with a wrapper for docker-compose
script that monkey-patches parallel logger for it to respect --log-level
. Not great, but immediately usable! Check it out:
https://github.com/berkmancenter/mediacloud-docker-compose-just-quieter
Has there been any movement on this issue? This would be very helpful. I need it for docker-compose run
As I find this quite essential: Is there any workaround for this problem? This is really annoying when I run e2e tests...
Just a suggestion (if I am understanding this thread right). Are you sure you are not looking for:
docker-compose up -d
? This only shows the starting messages and errors.
Just a suggestion (if I am understanding this thread right). Are you sure you are not looking for:
docker-compose up -d
? This only shows the starting messages and errors.
I actually found out that I can pass LOG_LEVEL=error
to the container as environment variable which stops the pollution from the server & db while e2e tests are running (in my situation).
I also cannot use -d
use because I need --abort-on-container-exit
, but in general this would work.
I think it's maybe wrong to think of this as logging. ParallelStreamWriter is writing ansi escape codes, so it is not designed for log streams (which is partly why we don't want to see it on build servers). So rather than getting ParallelStreamWriter muddled up with log levels (which I think is something different). Would it be better to have a --no-ansi option to suppress all ansi output?
ah wait ignore me. Read the docs and see docker-compose has exactly that option already but then this parallel output is just written line by line without ansi so you still get chatter on the build server
Most helpful comment
Has there been any movement on this issue? This would be very helpful. I need it for
docker-compose run