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.
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.
- Introduction to Kubernetes
- Introduction to Docker, Containers, Images & Repository
- Install and Run Docker Images
- Docker Image – FROM, RUN, COPY, ENTRYPOINT, CMD, EXPOSE explained
- Why docker run or start command not running my container?
- How to list all docker images in system?
- How to list all docker containers?
- How to start/stop a docker container?
- Difference between docker run and docker start
- How to bind docker container port with host?
- How to get logs of docker container?
- How to live stream logs of docker container?
- Set custom name to a docker container
- Access docker container filesystem & terminal
- Getting docker details using docker inspect
- Kyverno – Installation, Policies, Testing, Reporting, Monitoring, Security
- Complete Kubernetes Project Step By Step
- Introduction to Kubernetes Objects