Search
 
SCRIPT & CODE EXAMPLE
 

SHELL

docker-compose logs path

/var/lib/docker/containers/<container_id>/<container_id>-json.log
Comment

docker-compose logs path

Debugging Docker Issues with Container Logs
Docker has a dedicated API for working with logs. But, keep in mind, it will only work if you use the json-file log driver. I strongly recommend not changing the log driver! Let’s start debugging.

First of all, to list all running containers, use the docker ps command.

docker ps
Then, with the docker logs command you can list the logs for a particular container.

docker logs <container_id>
Most of the time you’ll end up tailing these logs in real time, or checking the last few logs lines.

Using the --follow or -f flag will tail -f (follow) the Docker container logs:

docker logs <container_id> -f
The --tail flag will show the last number of log lines you specify:

docker logs <container_id> --tail N
The -t or --timestamp flag will show the timestamps of the log lines:

docker logs <container_id> -t
The --details flag will show extra details about the log lines:

docker logs <container_id> --details
But what if you only want to see specific logs? Luckily, grep works with Docker logs as well.

docker logs <container_id> | grep pattern
This command will only show errors:

docker logs <container_id> | grep -i error
Comment

PREVIOUS NEXT
Code Example
Shell :: Method ReflectionParameter::getClass() is deprecated ubuntu 
Shell :: linux command linux distribution 
Shell :: install sublime text on ubuntu 20.04 
Shell :: rename local branch github 
Shell :: unzip specific folder linux 
Shell :: how to install android studio in ubuntu 
Shell :: run command as root administrator mac 
Shell :: gnome 42 force dark mode 
Shell :: git local setup 
Shell :: mac compress tar.gz pc 
Shell :: copy file to ubuntu server 
Shell :: mac m1 laravel global install 
Shell :: ls order by date 
Shell :: close terminal commang 
Shell :: sum bash 
Shell :: jupyter digits 
Shell :: Installing Docker Engine in Linux/Ubuntu 
Shell :: get changes from differente branch git 
Shell :: github fork my own repo 
Shell :: doc.find is not a function 
Shell :: install aptitude ubuntu 20.04 
Shell :: unzip in folder 
Shell :: cloning repository github 
Shell :: add group linux 
Shell :: restore staged github 
Shell :: windows cmd opens and closes 
Shell :: open current directory 
Shell :: command line windows find file 
Shell :: download terraform for mac 
Shell :: how to run a command async in ubuntu 
ADD CONTENT
Topic
Content
Source link
Name
1+7 =