Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Change Docker native images location on Windows 10 Pro

This is not a duplicate of Change Docker machine location - Windows

I'm using docker native, version 1.12.1-stable (build: 7135) on Windows 10 Pro with Hyper-V enabled. So docker is not running with VirtualBox nor do I have the folder C:\Users\username\.docker

I'd like to move docker's images, caches, ... to my secondary drive D:\

I guess I should edit the Docker Daemon configuration.

Docker Daemon Configuration

I tried to add "graph": "/D/docker". Docker started correctly but I couldn't pull any image because of an error

open /D/docker/tmp/GetImageBlob135686954: no such file or directory

How to tell docker to use another path to store its images, etc ?

like image 447
seza443 Avatar asked Nov 07 '16 13:11

seza443


People also ask

Where are the Docker images stored in Windows 10?

In a default installation, layers are stored in C:\ProgramData\docker and split across the "image" and "windowsfilter" directories. You can change where the layers are stored using the docker-root configuration, as demonstrated in the Docker Engine on Windows documentation.


2 Answers

Docker Desktop now can use WSL 2 Backend. In this mode, you need to move the wsl data.

In my case (Windows10 with Docker Desktop) none of the above solutions helped me, but I found the solution; run these commands.

This command changes the docker directory to drive D: (don't forget to quit docker desktop first)

wsl --shutdown wsl --export docker-desktop-data docker-desktop-data.tar wsl --unregister docker-desktop-data wsl --import docker-desktop-data D:\docker-new-repo\ docker-desktop-data.tar --version 2 

And now you can delete .tar file

There is a very good blog post explaining everything:

https://dev.to/kimcuonthenet/move-docker-desktop-data-distro-out-of-system-drive-4cg2

like image 133
Saeed Avatar answered Sep 21 '22 23:09

Saeed


Docker Version : 2.2.0.3 (42716)

  1. Right-click on docker icon on desktop tray

enter image description here

  1. Click on Settings

enter image description here

3 Click on Resources from the left-hand menu then under the Disk Image location click on browse and change the location

  1. Click on apply and restart
like image 26
Altair CA Avatar answered Sep 25 '22 23:09

Altair CA