How to view the log path of a Docker container?

To check the log path of a Docker container, you can use the following command:

  1. show me the running containers
docker ps
  1. examine the docker container
docker inspect <容器ID或名称> --format='{{.LogPath}}'

For example:

docker inspect my-container --format='{{.LogPath}}'

This will return the log path of the container, for example /var/lib/docker/containers//-json.log.

Note: If a non-default logging driver is used for the container, the log path may be different.

bannerAds