docker log and docker container log

One,

The log of the docker container is stored in the local /var/lib/docker/containers/container_ID/container_ID-json.log by default.

You can use the following command to check the location of the log file

docker inspect container_id | grep Log
或:docker inspect container_name | grep Log

You can cd to this folder.

Go to /containers here may be "Permission denied"

sudo chmod -R 777 ./containers

Add permissions, it's okay

二、docker logs

Print container log (-f is trace log output)

docker logs -f container_name

The container log is stored in a file

docker logs container_name >& 路径/文件名.log

 

Guess you like

Origin blog.csdn.net/wwqcherry/article/details/106452705