Docker log (driver json-file) location for Docker for windows

8.2k views Asked by At

I want to locate a container's log location.

  • I use Docker Desktop for Windows
  • I know that on linux they are at /var/lib/docker/containers/

But where is it. Is it hidden away somewhere in an inaccessible VM?

5

There are 5 answers

1
Mr Kashyap On BEST ANSWER

On windows you can find the containers logs inside:

C:\ProgramData\docker\containers\[Your_container_ID]\[Your_container_ID]-json.log
0
Rambler On

For windows , the container storage is the Hyper V's virtual Hard disk.You would have to connect to that hard disk to get the container logs.

See this lonk for more details :https://forums.docker.com/t/where-are-images-stored/9794/7

1
craftsmannadeem On

Windows 10 + WSL 2 (Ubuntu 20.04), Docker version 20.10.2, build 2291f61

Logging Driver

docker info --format '{{.LoggingDriver}}'
'json-file'

Docker Inspect LogPath

docker inspect --format='{{.LogPath}}' <Some_Container_id>
'/var/lib/docker/containers/bb69ae7df957c5f8c8b6d63372aa9cf9b94fa6ef0e44ccecbccb6d190baadb51/bb69ae7df957c5f8c8b6d63372aa9cf9b94fa6ef0e44ccecbccb6d190baadb51-json.log'

Docker Artifacts are stored in following location

DOCKER_ARTIFACTS == \\wsl$\docker-desktop-data\version-pack-data\community\docker

enter image description here

Location of container logs

DOCKER_ARTIFACTS\containers\[Your_container_ID]\[Your_container_ID]-json.log

Here is an example:

enter image description here

0
TrojanName On

In 2023, on Windows 10 these logs are now located at

\\wsl$\docker-desktop-data\data\docker\containers

but knowing Docker this could well have changed by the time you read this!

0
Bumuthu Dilshan On

In Windows 11, You can find the directories with container ids in this path,

\\wsl.localhost\docker-desktop-data\data\docker\containers

There, you have <container id>.log file which is what you want.