📄 Logs Documentation
🍃 This document provides instructions on how to log your application using Docker and Docker-compose.
Logging All Containers
This section provides instructions on how to log all containers in a Docker-compose file.
Via Docker-compose
👇 Logs all containers in ONE docker-compose file
docker-compose -f ./docker-compose.yml \
-p [project_name] \
logs --tail 50 --follow
docker-compose -f ./docker-compose.yml \
-p [project_name] \
logs --tail 50 --follow
👇 Logs all containers in MULTIPLE docker-compose file
docker-compose -f ./docker-compose.yml -f ./docker-compose.[dc_file].yml \
-p [project_name] \
logs --tail 50 --follow
docker-compose -f ./docker-compose.yml -f ./docker-compose.[dc_file].yml \
-p [project_name] \
logs --tail 50 --follow
Replace
[dc_file]
,[project_name]
with your Docker-compose file and project name respectively--tail 50
: 50 from the end--follow
: Real-time
👇 Quick Example
INFO
docker-compose -f ./docker-compose.yml -f ./docker-compose.local.yml -p leadersleague-v2 logs --tail 2
docker-compose -f ./docker-compose.yml -f ./docker-compose.local.yml -p leadersleague-v2 logs --tail 2
🍭 Demo
Logs ONE containers
This section provides instructions on how to log a single container
Via MakeFile (docker-compose)
TIP
👇 Use the recommended makefile command
make logs
make logs
And choose your container to log.
🍭 Demo
Via Docker
👇 Logs ONE container in ONE docker-compose file
docker logs --tail 50 --follow --timestamps [docker-container-name]
docker logs --tail 50 --follow --timestamps [docker-container-name]
Via Docker-compose
docker-compose -f ./docker-compose.yml -f ./docker-compose.[dc_file].yml \
-p [project_name] \
logs --tail 50 --follow [docker-container-name]
docker-compose -f ./docker-compose.yml -f ./docker-compose.[dc_file].yml \
-p [project_name] \
logs --tail 50 --follow [docker-container-name]
Change
[dc_file]
,[project_name]
&[docker-container-name]
with your Docker-compose file, project name, and Docker container name respectively.
👇 Quick Example
INFO
docker-compose -f ./docker-compose.yml -f ./docker-compose.local.yml -p leadersleague-v2 logs --tail 2 nginx
docker-compose -f ./docker-compose.yml -f ./docker-compose.local.yml -p leadersleague-v2 logs --tail 2 nginx