Docker : log multiple containers at once

Posted on: 2018-05-12

If you are working on a project and you chose to use a microservices architecture where every service run in a docker container, you might want to keep an eye on every container logs as you work on them. But attaching every container to a terminal can become a little messy as your number of microservices increases.

I wanted to create all my container detached (-d options of docker run) and have all the logs of all my containers in one terminal. So I made a little CLI tool that does just that :

npm install -g docklog

Then :

docklog -f my-container1 my-container2 ...

The -f option is the same than docker container log, it will "stream" the log to your console as they are being updated.