Where are the Docker images and Dockerfiles typically stored on a Linux server?

What is the location of the Docker images as seen with a “docker images” command?

On my Linux server, I searched for files by sizes (to try to find a correlation with the identified image in the results of “docker images”). But I think the virtual size shows is different than the image file itself. I search for file names that had a string pattern of the image id. I cannot identify where on the server the image files are. What directory should I try? I looked in /var/lib/docker/. I cannot seem to find it.

I ran separate searches like these too:

cd /
find . -name Dockerfile
find . -name dockerfile
find . -name DockerFile

I found nothing. Where is the dockerfile for the containers?

On systems I maintain, they’re in a separate LVM partition. I have no idea if they’re actually exposed in normal filesystem space. Heavily depending on the system layout, they might be somewhere under /var/lib/docker, but you probably shouldn’t go poking around in there.

The detailed per-layer history shown in docker history might be more informative to you. Since layers can be shared across images, you could have a dozen different images that all report as 4 GB each in docker images that actually share all of their space, taking up 4 GB total.

Dockerfiles are only used as input to the docker build command, and aren’t retained in the system or stored in images afterwards. (You could probably reconstruct them from docker history easily enough though.)

1 Like

What is the location of the Docker images as seen with a “docker images” command?

/var/lib/docker/image

is the default location for images