Where Are Docker Images Stored on the Host Machine?

When you pull or build a Docker image, it doesn’t magically live in a black box — it’s stored on your host system. Understanding where Docker stores these images can help with disk space management, troubleshooting, and system optimization.

In this blog, we’ll explore where Docker images are stored on different operating systems and how to access them.


📁 Default Storage Location

By default, Docker stores all images, containers, volumes, and other data inside Docker’s storage directory.

/var/lib/docker

This is the root storage directory on Linux systems. Within this folder, Docker uses a storage driver (e.g., overlay2) to manage image layers and containers.


📦 Storage Structure Breakdown

Inside /var/lib/docker, you’ll find folders like:

  • overlay2/: Stores image and container layers
  • containers/: Metadata and logs of containers
  • image/: Stores metadata about images
  • volumes/: Docker volumes

🔍 Images themselves live under the storage driver directory (like overlay2/), not directly in a simple .tar or .img format.


🪟 On Windows

Docker Desktop on Windows stores images inside a virtual disk used by the WSL2 backend or Hyper-V VM.

For WSL2 Backend:

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

You can access this from Windows Explorer or PowerShell.

📦 All actual image data is stored within the WSL2 Linux file system.


🍏 On macOS

On macOS (using Docker Desktop), images are stored in a LinuxKit VM using a virtual disk. You typically can’t access image files directly through Finder.

However, the disk is mounted at:

~/Library/Containers/com.docker.docker/Data/vms/0/

You can inspect or manage it using Docker CLI, but direct modification is discouraged.


🛠️ Change Docker Image Storage Location

If you’re running low on disk space in the default directory, you can change the Docker data root.

Steps (Linux):

  1. Create a new directory: sudo mkdir /new/docker-data
  2. Edit Docker daemon config: sudo nano /etc/docker/daemon.json Add: { "data-root": "/new/docker-data" }
  3. Restart Docker: sudo systemctl restart docker

🔍 How to View Docker Image Storage

To list all local Docker images:

docker images

To check Docker’s current data root:

docker info | grep "Docker Root Dir"

🧹 Bonus Tip: Clean Up Unused Images

To save space:

docker system prune -a

⚠️ This removes unused containers, networks, and all dangling images. Use with care.


✅ Summary

OSDefault Image Storage Path
Linux/var/lib/docker/overlay2
Windows\\wsl$\docker-desktop-data\...
macOS~/Library/Containers/com.docker.docker/Data/vms/0/

While you typically interact with images via Docker CLI, knowing where and how they are stored helps in managing system resources and storage more effectively.

Sharing Is Caring:

Leave a Comment