For Docker Compose
This will show logs in all services defined in docker-compose.yml file:
docker-compose logs
Code language: Bash (bash)
If you want it to watch all the new logs interactively, use the –follow flag:
docker-compose logs --follow
Code language: Bash (bash)
You might want to see only last 100 records in the screen:
docker-compose logs --follow --tail=100
Code language: Bash (bash)
You can also see the logs only for specific services in docker-compose.yml:
docker-compose logs <service_name(s)> --follow --tail=100
Code language: Bash (bash)
Any Docker Container
docker logs <container_name_or_id>
Code language: Bash (bash)
docker logs <container_name_or_id> --follow --tail=100
Code language: Bash (bash)
Reference:
1. https://docs.docker.com/engine/reference/commandline/compose_logs/
2. https://docs.docker.com/engine/reference/commandline/logs/
Leave a Reply