164

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.

IARI
  • 1,217
  • 1
  • 18
  • 35
Purnima Naik
  • 2,393
  • 5
  • 17
  • 25
  • 2
    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-naik – nkhuyu Apr 30 '17 at 06:03
  • See also [Is there a way to see container disk usage on Docker for Windows?](https://stackoverflow.com/questions/55875910/is-there-a-way-to-see-container-disk-usage-on-docker-for-windows) – Vadzim Sep 08 '19 at 11:19
  • 1
    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. – late1 Aug 20 '22 at 10:33
  • YES late! I agree fully. Still have not found my built images. Frustrating as hell!!! – Brian Reinhold Jun 07 '23 at 21:45

22 Answers22

153

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

jklemmack
  • 3,518
  • 3
  • 30
  • 56
BTC
  • 2,975
  • 1
  • 19
  • 25
  • 24
    And this should be accepted answer. ext4.vhdx file is located in: %AppData%\Local\Docker\wsl\data – Tomislav Jul 13 '20 at 20:18
  • 8
    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? – Čamo Jan 18 '21 at 10:14
  • 4
    %AppData%\Local\... does not exist found it on %LocalAppData%\Docker\wsl – fuchs777 Mar 18 '21 at 11:49
  • 1
    This is the right location, how to access it inside of this? The disk image isn't initialized : ( – Ido Bleicher Dec 19 '21 at 13:51
  • 15
    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. – Atul Feb 16 '22 at 10:03
  • 1
    C:\Users\{USER}\AppData\Local\Docker – Bryan Shalloway Aug 22 '22 at 06:34
  • 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? – Brian Reinhold Jun 07 '23 at 21:50
84

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.

neves
  • 33,186
  • 27
  • 159
  • 192
  • 2
    I think this is the only correct answer for WSL2. Certainly is on my system. – drkvogel Jan 16 '21 at 12:06
  • 12
    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. – Alexandr Zarubkin Apr 21 '21 at 09:45
  • 4
    @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) – Venryx Aug 29 '21 at 05:03
57

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

John
  • 6,701
  • 3
  • 34
  • 56
  • 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! – kmarabet Jul 30 '18 at 14:56
  • Maybe this file location is intended only for windows' images while I have only linux images pulled in my local docker platform! – kmarabet Jul 30 '18 at 15:04
  • 77
    The advanced tab doesn't seem to be available in the latest version these days. – Justin Helgerson Nov 01 '18 at 15:21
  • 1
    @kmarabet try `Public Documents` instead of `Documents` in the path – shwz Nov 09 '18 at 10:41
  • 1
    @shwz you're right there's a hyper-v there... but it's admin accessible only... bummer – Imad Apr 18 '19 at 16:29
  • @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". – Matt Jun 18 '19 at 13:37
  • 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. – jet_choong Sep 04 '19 at 08:03
  • @Matt 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. – Jean-François Beauchamp Jun 09 '20 at 16:51
  • @Jean-FrançoisBeauchamp, Not sure about the specific version, do you see tabs mentioned like in the article https://medium.com/@matt.thankachan/docker-how-to-change-drive-letters-for-docker-container-images-86a7a8f74b7d . Also see if you can change it via the json file – Matt Jun 10 '20 at 18:40
  • 2
    For v19.03.8, check the tab **Docker Engine** – Matt Jun 10 '20 at 18:49
  • Seems like they've moved this elsewhere. – Ashley Aug 24 '20 at 12:51
55
  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

evgenyl
  • 7,837
  • 2
  • 27
  • 32
  • 46
    On my Windows 10 machine, I get this path "Docker Root Dir: /mnt/sda1/var/lib/docker", which doesn't exists on my machine. – Purnima Naik Feb 15 '17 at 14:16
  • 2
    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 folder – evgenyl Feb 15 '17 at 15:25
  • 18
    My root dir is /var/lib/docker. Can I navigate to that folder via explorer? – Mike Casas Feb 01 '18 at 14:32
  • 1
    @MikeCasas Maybe you are using Linux containers, just right click the docker icon, choose `Switch to Windows containers...` – Tony Chou Jun 24 '18 at 07:59
  • @TonyChou, no, I want Linux continer. Just wondering if I could navigate to the folder. – Mike Casas Jun 25 '18 at 14:49
  • 61
    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. – lite-whowantstoknow Aug 22 '18 at 20:15
  • 17
    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 https://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) – Simon Mourier Aug 29 '18 at 09:15
  • 1
    i am not able to find path "Docker Root Dir: /var/lib/docker" on my machine – MangduYogii Mar 06 '19 at 06:28
  • 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\ – JoeyGutMen Feb 12 '21 at 12:09
  • 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. – mightycode Newton Mar 04 '22 at 14:28
  • /var/lib/docker for me – csandreas1 Jul 04 '22 at 07:58
36

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.

Alireza Fattahi
  • 42,517
  • 14
  • 123
  • 173
  • 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. – Bhathura Aug 09 '21 at 16:22
  • thanks for giving the clue, however i found it in a slightly different path: \\wsl$\docker-desktop-data\version-pack-data\community\docker\overlay2 – osama yaccoub Feb 16 '22 at 04:05
  • 2
    In my case I found volumes here: \\wsl$\docker-desktop-data\data\docker\volumes – MirrorBoy Dec 24 '22 at 18:40
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

VivekDev
  • 20,868
  • 27
  • 132
  • 202
  • 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/$$$ path – Ak777 Dec 19 '20 at 17:40
  • 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. – Jordan Gee Aug 18 '21 at 21:17
20

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.

JavierFuentes
  • 1,840
  • 18
  • 13
  • 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 locations – Matt Jun 18 '19 at 13:14
  • 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.. – Zach Smith Jul 28 '19 at 10:12
  • 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!! – mightycode Newton Mar 04 '22 at 14:36
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.

Chris
  • 3,400
  • 1
  • 27
  • 41
Martin Frey
  • 10,025
  • 4
  • 25
  • 30
  • 1
    thanks, that helped a lot instead of finding files. – muhammed ozbilici Aug 08 '22 at 10:47
  • 1
    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. – Jonas Feb 03 '23 at 13:04
15

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

Gaurav P
  • 1,097
  • 1
  • 14
  • 19
9

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

Mulder2008
  • 181
  • 3
  • 8
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
Matthieu Brucher
  • 21,634
  • 7
  • 38
  • 62
Crapper
  • 81
  • 1
  • 1
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

user1767316
  • 3,276
  • 3
  • 37
  • 46
7

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.

Atul
  • 3,778
  • 5
  • 47
  • 87
5

The docker desktop for windows 10 has been moved here:

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

%APPDATA%\Docker\settings.json

Ted
  • 1,641
  • 7
  • 30
  • 52
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

Micky Li
  • 51
  • 3
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
2

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

1

It should be here:

C:\ProgramData\Docker\tmp\
John
  • 2,633
  • 4
  • 19
  • 34
0

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

Adrian David Smith
  • 574
  • 1
  • 4
  • 26
hyn1006
  • 11
  • 2
-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

-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

bmshort
  • 208
  • 1
  • 6
-1

This worked for me:

%USERPROFILE%/.docker/config.json
Victoria Agafonova
  • 2,048
  • 10
  • 33
  • 50