Reputation: 51
I'm completely new to docker and ddev and I have just started learning things. My main purpose to use Docker & Ddev is to work on my CMS projects. However, I noticed that by default the docker gets installed in C drive (in my case its almost full). Therefore, I want to learn how to create my projects in D drive using DDEV.
For example I would like to have them organized in one single folder like D://Myprojects\Drupalsites\Mysite1 Something like that.
How do I do that?
Upvotes: 4
Views: 6950
Reputation: 406
I used various approaches but none of it really worked except for the below:
1. confirm docker-desktop-data is present
wsl -l -v
2. Shutdown WSL
wsl --shutdown
3. Run below command in single line (added in multiple lines for better reading)
wsl --export
docker-desktop-data
"new drive tar path e.g. D:\ceres_dwh\Docker_WSL\dockerdesktop.tar"
4. Unregister desktop-data
wsl --unregister docker-desktop-data
5. confirm docker-desktop-data is not present anymore
wsl -l -v
6. Run below command in single line (added in multiple lines for better reading)
wsl --import
docker-desktop-data
"new drive wsl path e.g. D:\ceres_dwh\Docker_WSL
"new drive tar path e.g. D:\ceres_dwh\Docker_WSL\dockerdesktop.tar"
7. Reboot..
Reboot PC!
8. confirm docker-desktop-data is present again!
wsl -l -v
Credits to: https://www.youtube.com/watch?v=gWBNk2KYg3M
Upvotes: 0
Reputation: 4891
There are command line params when you install docker desktop to move the images for both docker and wsl to another drive.
"./Docker Desktop Installer.exe" install --always-run-service --accept-license --windows-containers-default-data-root=d:\dockerimages
and if you have as well moved your wsl images over to d, then you'll need to add this switch on the installer command above
--wsl-default-data-root=d:\wsl
Upvotes: 0
Reputation: 12975
Your problem isn't DDEV and your projects, it's docker using up your space, at at least as far as I understand your question.
So what you're really wanting to do is to move your Docker WSL2 data distro over to the new drive. As far as I know Docker and WSL2 don't provide a simple way to do this, but these two links will tell you how you can do it.
I have not tried this.
One note though: Most people these days are doing the recommended thing and running DDEV inside WSL2 (in /home/<youruser>
). But if you already have trouble with disk space with WSL2, you're going to have trouble with that as well. But WSL2 should be your future, see https://ddev.readthedocs.io/en/stable/#installation-or-upgrade-windows-wsl2
Upvotes: 3