Docker Community Forums

Share and learn in the Docker community.

Where are images stored?

Thanks for your post. To clarify, are you curious about the placement of the docker images (they’re in the hyper-v VM) or the Hyper-V VM harddrive (it’s typically in C:\Users\Public\Documents\Hyper-V\Virtual hard disks)?

7 Likes

/var/lib/docker is mounted on the persistent Virtual Disk of the VM which is under C:\Users\Public\Documents\Hyper-V\Virtual hard disks - doesn’t that answer both? :stuck_out_tongue:

4 Likes

Ok. Thanks Michael and Vincent. To confirm, docker is storing the images in the Moby instance, so its all in the virtual disk. Which means, that if I need to relocate the storage to another physical drive (outside of hyper-v), I have to move that file - and of course change the VM info, or make that folder a symbolic link (or similar) to somewhere else.

Thank you. I was worried about maxing out my C drive, which is not very large.

David

1 Like

how do i change the location ??? because “C” is not my biggest drive :slight_smile:

3 Likes

In Windows 10,

  1. Stop docker etc
  2. Type “Hyper-V Manager” in task-bar search box and run it.
  3. Select your PC in the left hand pane (Mine is called DESKTOP-CBP**)
  4. Right click on the correct virtual machine (Mine is called MobyLinuxVM)
  5. Select “Turn off” (If it is running)
  6. Right click on it again and select “Move”
  7. Follow the prompts
18 Likes

Nice! You fixed my problem

There is still a confusion lingering in my mind. When I create a new image using docker build, I get the last line of the log as
Successfully built a854b5869839.
However when I look for images in C:\ProgramData\docker\windowsfilter or C:\ProgramData\docker\containers I do not find any folder with a similar name (which I believe I read somewhere on Stackoverflow houses the images).

Where is this image a854b5869839 located?
Any way my “C:\Users\Public\Documents\Hyper-V\Virtual hard disks” folder is empty. Any idea on this?

4 Likes

Thanks :grin:
how about C:\ProgramData\Docker? What is Docker doing with it? In particular, if it will grow big, how can I move it away from C:? :confused:

I am new with docker an also have this problem.
I just want to share my solution.

Before installing docker just change the location of the Virtual Hard Disk from the Hyper-V settings.
Then by default docker will install there.

Hi

All the hyperv configuration is not related to windows containers, right?
Like alexfung says, looks like all data is stored in C:\ProgramData\Docker
I need to download images and create containers in other drive than c too!!

Any information will be nice!!

Create file called c:\programdata\docker\config\daemon.json with content below where e:\images is location where do you want to store all you images etc. restart docker.

{

 "graph": "e:\\images" 
}

I added the data as you sugested, after restarting the docker service and try to view the existing images I got the following error

c:\desarrollo>docker images error during connect: Get http://%2F%2F.%2Fpipe%2Fdocker_engine/v1.27/images/json: open //./pipe/docker_engine: The system cannot find the file specified. In the default daemon configuration on Windows, the docker client must be run elevated to connect. This error may also indicate that the docker daemon is not running.

I’m sure that my new images folder exist

When I restart my computer my modification to daemon.json file is lost
I just got a daemon.json file like this

{}

I found it!

I need to edit the settings inside the UI (I’m using windows containers), Docker will auto restart

After restart, using

docker info

I can see

Docker Root Dir: D:\vm\docker
2 Likes

Docker on Windows:

I would like to store images on 1 iSCSI volume and store containers a different iSCSI volume.

Can you use “graph” multiple times in the daemon.json config file to tell Docker that images are on 1 volume and containers are on a 2nd ( different ) volume?
ex.
“graph”: “I:\images”
“graph”: “E:\containers”

If not, what is the best way to handle this configuration?

No, you cannot - images and containers are the same thing. A container is an image with a writable layer on top (and other things too). Details here: https://docs.docker.com/engine/userguide/storagedriver/imagesandcontainers/

Updating my settings via the UI to include:

{
  "graph": "..."
}

to set a custom location causes Docker to not restart properly. Looking into the logs it looks like the Docker daemon is not starting properly:

[12:38:03.428][DockerDaemonChecker][Error  ] Docker daemon is not running

Anyone else come across this and could advise on a solution?

Using 17.06.0-ce-win19 on Windows 10 Pro.

I use graph both on my Win10 and Windows 2016 machine with no issues. You need to start dockerd with -D switch and post debug logs here

My problem is different. My home internet is limited and therefore I mostly downloaded ubuntu image for my windows in my office. How shall I proceed to use this image with windows on my Home PC.

Office PC-Windows 7
Home PC- Windows 10

Hi - in case anyone’s running into this now (May 2018), you can change the location where Windows images are stored by setting this in the daemon config file:

{
“data-root”: “d:\docker”
}

details here https://docs.microsoft.com/en-us/virtualization/windowscontainers/manage-docker/configure-docker-daemon

1 Like

I think that should be “data-root”: “d:\\docker”