Where is docker image location in Windows 10?
DockerDocker ComposeDocker for-WindowsDocker Problem Overview
I'm using the Windows 10 Home operating system. I have installed Docker toolbox.
I have created a docker image of my .net core application by using following command.
$ docker build -t helloWorld:core .
Now I want to ship this image, to another machine. But I am not getting the image file.
Can someone please tell me, where my image will get saved? Or is there any way, to specify docker an image path in docker build command.
Docker Solutions
Solution 1 - Docker
All the answers have been outdated or incorrect for me, I found it in "%localappdata%\Docker\wsl"
Solution 2 - Docker
The answers are really confusing because there is more than one way to run Docker in Windows. The newest way is with Windows 10 Home May 2020 Update. It will use the new version of Windows Subsystem for Linux (WSL2). This answer is about this configuration.
After activating WSL2, you'll install Docker Desktop. Docker Desktop is a client that'll connect to the host inside the WSL.
The image directory is somewhat inconsistent. If you run docker info
in your host machine or inside WSL it will give you the path Docker Root Dir: /var/lib/docker
which doesn't exist:
$ ls /var/lib/docker
ls: cannot access '/var/lib/docker': No such file or directory
You'll find the images in
/mnt/wsl/docker-desktop-data/
Or in this Windows Explorer path:
\\wsl$\docker-desktop-data\mnt\wsl\docker-desktop-data\data\docker\image
If you are using Windows 10 non-Home versions, it may work differently. Take a look at the other answers. Since I don't have access to this OS, I won't try to answer.
Solution 3 - Docker
On Windows 10, right click on the docker icon in the system tray (right hand side of task bar) and choose Settings... In the Advanced pane, you'll see something like:
Solution 4 - Docker
- By using the
docker info
command. - In the result - check for Docker Root Dir
This folder will conatins images, containers, ...
Solution 5 - Docker
If you are on windows 10 and running windows containers
In the above image, docker is running windows containers. So its showing switch to linux containers.
First run docker info
command (more specific docker info --format “{{json .DockerRootDir}}”
).
You should see root dir as
Docker Root Dir: C:\ProgramData\Docker
Now run a command to pull an image like
docker pull hello-world
After it pulls the image, you can look into the docker root dir.
Notice the current modified date time. In one of the folders you can see the sha of the layers.
Finally, you also have to take a look into the following folder, if you want to know where the images are downloaded. The two folders above and below are
- C:\ProgramData\Docker\image\windowsfilter
- C:\ProgramData\Docker\windowsfilter
Now for linux images.
If your docker is running windows containers, and then if you try to fetch a linux based container such as nginx, like so
docker pull nginx:latest
you will get a message as follows.
latest: Pulling from library/nginx
no matching manifest for windows/amd64 10.0.18363 in the manifest list entries
So switch to linux contaners. See the very first image.
Once the docker for linux is running, run the command again.
docker pull nginx:latest
You can see that image is downloading.
Now where is this image downloaded on your hard disk? docker info command may not help much in this case.
So start again. Click Settings and now "Switch to Windows Containers..."
And now see the path.
On my machine, it's C:\ProgramData\DockerDesktop\vm-data
Note the date modified column. Notice and observe that after you pull or remove a linux based image.
That's a diskspace reserved for linux env, so you will not be able to browse further down to see where the image is.
but if you have to, then launch a linux based VM, install docker and explore the path /var/lib/docker/
Sometimes you may encounter permission issues. If so see this and this
Solution 6 - Docker
When you have Windows Containers activated, your images are stored by default in C:\ProgramData\Docker\
To change this, you can edit the C:\ProgramData\Docker\config\daemon.json
and add a new "graph"
key with the new path... (notice that every backslash is escaped with another backslash)
Example:
{
"registry-mirrors": [],
"insecure-registries": [],
"debug": true,
"experimental": false,
"graph": "D:\\ProgramData\\Docker"
}
After that, you need to restart Docker service and you can verify your changes using docker info
command and look at Docker Root Dir
entry.
Solution 7 - Docker
If you are using docker on Windows Subsystem for Linux (WSL2), you can access the images via hidden share:
\\wsl$\docker-desktop-data\version-pack-data\community\docker\overlay2
The volums are also there at:
\\wsl$\docker-desktop-data\version-pack-data\community\docker\volumes
The docker version is 20.10.7
If you want to go deeper, the docker-desktop-data
is actually located in a file at your AppData\Local
as a vhdx
( virtual machine disk) C:\Users\YOUR_USER_NAME\AppData\Local\Docker\wsl\data\ext4.vhdx
You can terminate docker process and open ext4.vhdx
file ( with 7zip for example), and there you can see version-pack-data\community\docker
in this file.
Solution 8 - Docker
mine can be found in "C:\Users\Public\Documents\Hyper-V\Virtual hard disks"
Solution 9 - Docker
I was not able to find the location of a WSL based Docker installation. But there is a simple way with docker commands itself to get the image!
docker image save myimagename -o myimagename.tar
This creates an archive file you can browse through with 7zip or a similar program.
Solution 10 - Docker
you can use below command to export your image and can copy same to linux / another machine docker export [OPTIONS] CONTAINER
example:
docker export --output="latest.tar" red_panda
Solution 11 - Docker
To to ship this image, to another machine :
docker ps -a
#or docker container ls -a
docker commit <container-id> mynewimage
#start here if you never started your image
#(ex: if just created using docker build -t helloWorld:core .)
docker image ls
docker save mynewimage > /tmp/mynewimage.tar
On the other machine:
docker load < /tmp/mynewimage.tar
docker images
As explained in comments above, when working on windows with linux containers, containers resides within the docker disk image located at DockerDesktop/settings/advanced/DiskImageLocation
see here
Solution 12 - Docker
In Recent Docker Desktop - which now uses WSL, the docker image location in Windows 10 is changed -
(last tested with Docker Desktop Community version 2.3.0.3)
First use Run - and type \\wsl$
This will open the file explorer, and display the folders as below -
docker-desktop
docker-desktop-data
Browse the directories to see the required files. Make sure docker desktop is running
Solution 13 - Docker
The docker desktop for windows 10 has been moved here:
c:/users/<user>
/AppData/Roaming/Docker/settings.json
Solution 14 - Docker
I don't know why are you trying to reach the image, but you can create a backup file from it just using docker command and load it afterwards where you wish. Example:
$ docker save -o ubuntu.tar ubuntu:lucid ubuntu:saucy
It will save a tar file in your Windows home directory. To load it:
$ docker load --input ubuntu.tar
Solution 15 - Docker
It should be here:
C:\ProgramData\Docker\tmp\
Solution 16 - Docker
Solution 17 - Docker
For me, running on Window 10 Professional version 20H2 with Docker Desktop 4.5.1 (74721), the location of images seems to be under my user directory as the following picture.
Solution 18 - Docker
This worked for me:
%USERPROFILE%/.docker/config.json
Solution 19 - Docker
By default it is inside C:\Users\Public\Documents\Hyper-V\Virtual hard disks
directory (.vhdx file).
It can be changed in Docker's settings > Advanced > Disk image location
Solution 20 - Docker
I am running on Windows 10 Home Version 2004 with Docker 19.03.8. This has the new WSL back-end - in that configuration, launch a WSL prompt (Win-r then wsl to launch) and my image files are under /mnt/host/wsl/docker-desktop-data/data/docker