Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I tail the logs of ALL my docker containers?

I can tail the logs of a single docker container by doing:

docker logs -f container1

But, how can I tail the logs of multiple containers on the same screen?

docker logs container1 container2 

doesn’t work. It gives an error:

“docker logs” requires exactly 1 argument(s).

Thank you.

like image 252
user674669 Avatar asked Mar 01 '18 04:03

user674669


People also ask

How do I collect docker logs?

Docker container logs are generated by the Docker containers. They need to be collected directly from the containers. Any messages that a container sends to stdout or stderr is logged then passed on to a logging driver that forwards them to a remote destination of your choosing.

How do I export docker logs?

Redirect Docker Logs to File Since Docker merges stdout and stderr for us, we can treat the log output like any other shell stream. To redirect the current logs to a file, use a redirection operator. To send the current logs and then any updates that follow, use –follow with the redirection operator.

How do I check running container logs?

Docker Command for Checking Container Logs Replace container_id with the ID number of the container you want to inspect. To find the container ID, use the docker ps command to list running containers. As in the image below, Docker responds by listing the event logs for that specific container in the output.

How do you persist container logs?

You can persist all container log files by creating a volume mount point to the Docker host machine or central log server. Since every container has its own unique log folder ( containerType _ containerId ), you can simply mount all container log directories (*/logs/) to the same path on your host machine.


1 Answers

If you are using docker-compose, this will show all logs from the diferent containers

docker-compose logs -f
like image 119
jonhid Avatar answered Nov 12 '22 06:11

jonhid