Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Filter docker-compose output

I have several containers that give many hundreds of lines of output when I do a docker-compose up and load all my services. Is there a way to filter that output easily or better yet, not have those services output to standard out, when doing docker-compose up?

like image 776
Ben Nelson Avatar asked Nov 07 '16 23:11

Ben Nelson


People also ask

How do you tear down a docker?

One way to remove a running Docker container is first to stop that container using the docker stop command and then use the docker rm command to remove it. We can use the -f option to remove a single Docker container, multiple Docker containers, or all the Docker containers.

How do I grep a docker log?

Using -f or --follow option, if you want to follow the logs: docker logs <container_id> --follow. If you want to see the last N log lines: docker logs <container-id> --tail N. If you want to see the specific logs, use the grep command: docker logs <container_id> | grep pattern.


1 Answers

Use detached mode when you start your docker compose

docker-compose up -d

If you want to see the logs of your containers, you can do:

docker-compose logs <name of your service that was defined in docker-compose file>
like image 126
Hy L Avatar answered Sep 21 '22 11:09

Hy L