How to continuously stream logs of docker container?

stream logs of docker container

We saw in our last article how to get logs of a docker container. In this article we will see how to continuously stream the logs in host machine.

For getting the live streaming of logs of your docker container, use this command –

docker logs container_id -f

Here we have added -f flag which is responsible to live stream the logs.

live streaming logs of docker container

From our previous article you must remember that we had created a mongo container with name mongo-container. Here we are displaying it’s logs with stream. So, as soon as an event happen and generates a mongo log, it will get displayed in our terminal.