Purnima Naik
Purnima Naik

Reputation: 2683

Where is docker image location in Windows 10?

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.

Upvotes: 192

Views: 345925

Answers (24)

John
John

Reputation: 6795

On Windows 10 and Windows 11, right click on the docker icon in the system tray (right hand side of task bar) and choose Settings (or Change Settings).

In the Advanced pane (or Resources in newer versions), you'll see something like this:

Screenshot of the Docker Desktop Settings window

Upvotes: 62

RonnieScotland
RonnieScotland

Reputation: 180

In Docker Desktop v4.29 you can add the 'image-tools' extension:

  1. Click on '+ Add Extensions'
  2. Select 'image-tools' to add this as an extension
  3. Once added, then select that extension
  4. From the list of containers, select your one
  5. All the way to the right under the Action column you can 'Save image to path'
  6. Choose the folder where you want to save
  7. A .tar file will be saved to that directory

Upvotes: 2

Peter Bäckgren
Peter Bäckgren

Reputation: 71

(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

Upvotes: 2

Ted
Ted

Reputation: 1690

The docker desktop for windows 10 has been moved here:

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

%APPDATA%\Docker\settings.json

Upvotes: 5

Gaurav P
Gaurav P

Reputation: 1107

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

Upvotes: 16

hyn1006
hyn1006

Reputation: 41

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

Upvotes: 3

Atul
Atul

Reputation: 4340

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.

Upvotes: 11

MmM
MmM

Reputation: 3581

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

Upvotes: 208

Micky Li
Micky Li

Reputation: 51

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

Upvotes: 3

VivekDev
VivekDev

Reputation: 25543

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

Upvotes: 25

Alireza Fattahi
Alireza Fattahi

Reputation: 45583

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.

Upvotes: 39

Martin Frey
Martin Frey

Reputation: 10075

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.

Upvotes: 16

Victoria Agafonova
Victoria Agafonova

Reputation: 2178

This worked for me:

%USERPROFILE%/.docker/config.json

Upvotes: -1

neves
neves

Reputation: 39433

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.

Upvotes: 89

Pinak Mazumdar
Pinak Mazumdar

Reputation: 59

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

Upvotes: 2

It should be here:

C:\ProgramData\Docker\tmp\

Upvotes: 1

Gustavo N&#243;brega
Gustavo N&#243;brega

Reputation: 79

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

Upvotes: 2

bmshort
bmshort

Reputation: 216

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

Upvotes: -1

Maciej Bledkowski
Maciej Bledkowski

Reputation: 713

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

Upvotes: -1

user1767316
user1767316

Reputation: 3651

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

Upvotes: 8

JavierFuentes
JavierFuentes

Reputation: 1858

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.

Upvotes: 21

Crapper
Crapper

Reputation: 81

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

Upvotes: 8

Mulder2008
Mulder2008

Reputation: 181

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

Upvotes: 9

evgenyl
evgenyl

Reputation: 8117

  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

Upvotes: 58

Related Questions