Where is docker image location in Windows 10?
Asked Answered
C

23

180

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.

Cauvery answered 15/2, 2017 at 13:4 Comment(4)
Have you checked : C:\Users\Public\Documents\Hyper-V\Virtual hard disks\MobyLinuxVM.vhdx? I find mine there. Thank you for asking the question. @purnima-naikHoratius
See also Is there a way to see container disk usage on Docker for Windows?Equiprobable
I wouldn't have guessed in a million of years that the biggest problem in my project would be to find out where the image is stored.Larcenous
YES late! I agree fully. Still have not found my built images. Frustrating as hell!!!Cerys
D
178

All the answers have been outdated or incorrect for me, I found it in %localappdata%\Docker\wsl

Distract answered 21/6, 2020 at 8:8 Comment(9)
And this should be accepted answer. ext4.vhdx file is located in: %AppData%\Local\Docker\wsl\dataTyro
I dont inderstand it. I expect docker file or something like json or yml file. How can I change config values e.g. for db connection?Existentialism
%AppData%\Local\... does not exist found it on %LocalAppData%\Docker\wslCarnet
This is the right location, how to access it inside of this? The disk image isn't initialized : (Gibun
Oh my God whole internet is full of people searching where is docker image file. What a pathetic design and support by Docker creators. Finally I found correct answer here. Many thanks.Wimble
C:\Users\{USER}\AppData\Local\DockerHydrochloride
There is something wrong here. I DO see ext4.vhdx in that location with the correct time stamp. But it is not the name I gave it and the size is 2.5 GB. docker images says its size is just under 500 MB. What is missing here?Cerys
My ext4.vhdx was at ~60 GB despite having pruned everything using Docker and I used wsl --shutdown and wsl --unregister docker-desktop-data which removed the virtual drive. Starting Docker Desktop created a fresh one, and I changed the default WSL distro back using wsl --setdefault docker-desktop-data.Whereunto
Mind that you can change the location manually even through the Docker Desktop UI Settings page. Which also moves all previously files stored at the original location.Fourscore
F
88

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.

Forwarder answered 18/6, 2020 at 2:14 Comment(4)
I think this is the only correct answer for WSL2. Certainly is on my system.Lipo
Now the path \\wsl$\docker-desktop-data\mnt\wsl\docker-desktop-data\data\ is empty for me, although docker info says I have 4 images.Dolhenty
@AlexandrZarubkin The correct path in my case was: \\wsl$\docker-desktop-data\version-pack-data\community\docker\image and/or \\wsl$\docker-desktop-data\version-pack-data\community\docker\overlay2 (depending on what you're looking for)Infield
I think the latest is \\wsl.localhost\docker-desktop-data\data\docker\image\overlay2\imagedb\content\sha256 now..Septal
R
59

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:

enter image description here

Rachmaninoff answered 19/11, 2017 at 7:22 Comment(12)
Could get this path location in the Advanced Settings menu, but this path doesn't exist in my file system despite have set to show hidden and system files & folders!Gossipmonger
Maybe this file location is intended only for windows' images while I have only linux images pulled in my local docker platform!Gossipmonger
The advanced tab doesn't seem to be available in the latest version these days.Doud
@Gossipmonger try Public Documents instead of Documents in the pathMatch
@Match you're right there's a hyper-v there... but it's admin accessible only... bummerRebeccarebecka
@JustinHelgerson You get advanced option only when docker uses Linux containers. For Windows container you can go to Docker Settings --> Daemon Tab on left --> Select Advance toggle button and update the JSON file with "data-root" : "E:\\DockerContainers".Snoopy
I'm using latest free version Docker on Windows 10 (linux containers) and I'm able to change the images storage location by specifying Disk image location located in Advanced tab in Docker Settings. Just updated mine and Docker required a restart VOILA it doesn't eat up my SSD spaces C drive anymore.Acquire
@Snoopy I am using Docker v19.03.8 on Windows 10 and Windows Containers, and there is no Daemon tab on the left. There is just General, Resources, Docker Engine and Command Line.Harder
@Jean-FrançoisBeauchamp, Not sure about the specific version, do you see tabs mentioned like in the article medium.com/@matt.thankachan/… . Also see if you can change it via the json fileSnoopy
For v19.03.8, check the tab Docker EngineSnoopy
Seems like they've moved this elsewhere.Markel
It's moved into the Resources Settings.Stovepipe
D
56
  1. By using the docker info command.
  2. In the result - check for Docker Root Dir

This folder will conatins images, containers, ...

enter image description here

Deoxidize answered 15/2, 2017 at 13:18 Comment(11)
On my Windows 10 machine, I get this path "Docker Root Dir: /mnt/sda1/var/lib/docker", which doesn't exists on my machine.Cauvery
Are you running Docker or Docker Toolbox? By the logs, it seems that you are running Docker-Toolbox, which runs the linux VM for docker-machine. In this case - conect to docker-machine, and go to this specified folderDeoxidize
My root dir is /var/lib/docker. Can I navigate to that folder via explorer?Bosnia
@MikeCasas Maybe you are using Linux containers, just right click the docker icon, choose Switch to Windows containers...Suneya
@TonyChou, no, I want Linux continer. Just wondering if I could navigate to the folder.Bosnia
Why is it impossible to get good information about docker?? This is so frustrating! Like the people above, I am running linux containers on a Windows 10 machine and I am unable to figure out what magical location docker stores the containers in.Abacist
If you have linux containers on a Windows 10 machine, containers are stored in the MobyLinuxVM.vhdx file. You can't mount or explore that file AFAIK, but you can still list the containers inside that machine using this 'blue pill' trick blog.jongallant.com/2017/11/ssh-into-docker-vm-windows by default containers are stored in the linux path /var/lib/docker in that virtual machine (you can confirm that linux path from a docker info command)Mussel
i am not able to find path "Docker Root Dir: /var/lib/docker" on my machineSherrer
First, check if you are running windows containers since this just work for them (windows containers are not the same to run docker in window ok?). In case you are running Linux containers, images are in WSL, thus you must check out if they are in the virtual file located in %AppData%\Local\Docker\wsl\data\Thickening
By me: Docker Root Dir: /var/lib/docker. But with no indication of driver?? So I installed docker on my E drive. Not my windows disk(C). So I looked in E for var. But it doesn't has a lib in var?? very very confusing.Madrepore
/var/lib/docker for meSmithery
B
39

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

enter image description here

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.

Barquentine answered 20/6, 2021 at 5:54 Comment(3)
Thanks, I could see these paths on my machine. But where are mounted on windows drive. Like in the screen shot (which was from a previous version of docker) we could change location to another drive via GUI even for linux container, but now we can't. Not sure to where \\wsl$ is mounted in windows. I want to change it to D drive as C is all full.Aciniform
thanks for giving the clue, however i found it in a slightly different path: \\wsl$\docker-desktop-data\version-pack-data\community\docker\overlay2Evalynevan
In my case I found volumes here: \\wsl$\docker-desktop-data\data\docker\volumesWeen
S
23

If you are on windows 10 and running windows containers

docker 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.

Docker location on windows

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

Docker location

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..."

Settings On Docker Desktop for linux containers

And now see the path.

Settings Page on docker desktop showing the path

On my machine, it's C:\ProgramData\DockerDesktop\vm-data

LinuxImages location

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

Sparid answered 6/3, 2020 at 7:29 Comment(2)
THanks, this is helpful but i need little more help further from here. I do see the Dockerdesktop for 7gb data size. Could you explain or share me links on how to clean up those or see further inside whats holding that 7gb? Also, my docker settings is currently set to linux containers it seems, as i see an option to switch to windows containers only. Although, i do not see the images of linux containers in /programData/Docker/$$$ pathRosebay
What does it mean "Click Settings and not "Switch to Windows Containers...""? BTW on my system is the same as in your answer (because it turned out I'm using WSL1), but I do not need to switch to windows containers anyway, to view it.Crutchfield
D
21

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.

Dynamometry answered 15/2, 2019 at 21:24 Comment(3)
Javier is right. You get advanced option only when docker uses Linux containers. Also i believe we use "data-root" for providing the image locationsSnoopy
I see that there is a setting in the Docker context menu - switch to Windows Containers. I thought that this would mean that the 'base container' would be a Windows OS instead of a Linux OS. But this is not the case? I would like to be able to access the virtual HD in the Hyper V virtual hard disks. But this seems impractical..Reconsider
for me: C:\Users\savantKingShirt\.docker. Holy holy!! really docker is putting everywhere files on my disks. holy crap!! and my vhdx file is already 2GB!!Madrepore
M
16

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.

Memorandum answered 24/10, 2020 at 10:15 Comment(2)
thanks, that helped a lot instead of finding files.Multiply
This honestly sounds like the answer that is also future-proof across potential changes to the internal storage. I know it's not strictly the requested answer but the one I will definitely be using to get it into distributable form.Moshe
S
16

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 -

  1. docker-desktop
  2. docker-desktop-data

Browse the directories to see the required files.

Note: Make sure docker desktop is running before using \\wsl$ command

enter image description here

Seve answered 26/6, 2021 at 17:4 Comment(0)
W
11

As of today 29 Aug 2022:

Here:

%localappdata%\Docker\wsl

And here:

C:\ProgramData\DockerDesktop\vm-data

And in older days it was here:

C:\Users\Public\Documents\Hyper-V\Virtual hard disks

So yes. ProgramData, AppData, Documents etc etc they can store just anywhere on your disk. Docker is perfectly unorganized product. Wastes lots and lots of time of developers figuring out little little things.

Wimble answered 28/8, 2022 at 18:47 Comment(0)
D
9

mine can be found in "C:\Users\Public\Documents\Hyper-V\Virtual hard disks"

Depressed answered 22/9, 2017 at 9:21 Comment(0)
B
8

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
Bloodstained answered 22/10, 2018 at 20:41 Comment(0)
A
8

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

Algorism answered 17/11, 2019 at 7:22 Comment(0)
B
5

The docker desktop for windows 10 has been moved here:

c:/users/<user>/AppData/Roaming/Docker/settings.json

%APPDATA%\Docker\settings.json

Bedder answered 7/11, 2019 at 16:30 Comment(0)
R
3

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.

enter image description here

Receptionist answered 10/3, 2022 at 3:35 Comment(1)
Ditto. It can be found at Docker Desktop->Settings->Resources->AdvancedCremator
C
2

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
Constellate answered 3/2, 2021 at 12:13 Comment(1)
Because I want to upload the image to an AWS instance.Catechin
C
2

For me, the containers were under container location in Docker Desktop when using Docker desktop on Windows with WSL2.

Colene answered 22/6, 2021 at 12:2 Comment(4)
Can you please add the path in string format as well maybe?Mosemoseley
\\wsl$\docker-desktop-data\version-pack-data\community\docker\containersColene
This is the location of the containers, not the images. An image is the base file(s) to create a container.Ciccia
@FelipeCorrea, Yes it is.Colene
S
1

It should be here:

C:\ProgramData\Docker\tmp\
Shaquana answered 1/3, 2021 at 7:12 Comment(0)
C
1

With Engine: 20.10.17(Windows 10), I found my docker container at path: \\\wsl.localhost\docker-desktop-data\data\docker\containers

You can see detail below: image

Credible answered 23/12, 2022 at 4:38 Comment(0)
L
0

(since so many answers are outdated and I don't have rep 50 to simply comment, duh)

Docker Desktop for Windows seems to have the files here: C:\Users\USERNAME\AppData\Local\Docker\wsl

Probably better to export what you want to share instead with (OWASP10 webgoat example)

docker save -o c:\temp\mygoat.tar webgoat/goatandwolf

Which I suspect can then be picked up by another user using

docker load --input c:\temp\mygoat.tar

Lahdidah answered 14/11, 2023 at 11:21 Comment(2)
If you can't comment, you can click Edit to Suggest a change for improvement.Radiotelephone
Above approach (directory correct as another user, save and load for container) confirmed as working. Will test edit to suggest changes in the future. Ty, not using SO much anymore, probably had a "good" account 10 years ago.Stouffer
B
-1

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

Byrd answered 20/1, 2020 at 2:23 Comment(1)
This is outdatedAretta
M
-1

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

Mercier answered 5/7, 2020 at 14:59 Comment(0)
M
-1

This worked for me:

%USERPROFILE%/.docker/config.json
Madonia answered 30/8, 2021 at 21:20 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.