Manage Host Disk Volume Size

To facilitate development and unit testing of data-tier applications, we run Oracle 12c on Oracle Linux Docker containers. The file systems of containers can get pretty big, which is not a problem for our EC2 Linux Docker servers, and those on my dev team that run the containers locally on their Macs. However, for those of us who run Windows, we constantly run into problems because the MobyLinuxVM runs out of disk space.

I have been unable to find a way to increase the size of the host virtual disk. Am I missing something here?

1 Like

I had also posted against an open Issue on the Docker for Windows Github repo. On that thread, @jasonbivens was able to provide a work-around that enabled me to increase the volume size of my MobyLinuxVM.

Here are the warnings and caveats:

  • * This process will destroy all Images and Containers on your local Docker. You will need to take steps to archive images and containers before doing this and will need to take steps to restore them when done. Consult the user guides for more info.
  • * The manual changes made by this process will be overwritten during upgrades or re-installs of Docker for Windows
  • * I recommend taking a backup of the Powershell script you are editing both before and after editing it. You can use the post-change backup file to manually restore your customizations after a re-install.

Here are the instructions:

  1. #1) Stop Docker
  2. #2) Start Powershell ISE as Administrator
  3. #3) Using the Powershell command prompt, make a backup of the file to be edited: cp C:\Program Files\Docker\Docker\Resources\MobyLinux.ps1 C:\Program Files\Docker\Docker\Resources\MobyLinux.bak
  4. #4) In Powershell ISE, open the file C:\Program Files\Docker\Docker\Resources\MobyLinux.ps1
  5. #5) Find the entry $global:VhdSize (Line 86 in version 17.06.1-ce-win24 (13025))
  6. #6) Change the first number in this line $global:VhdSize = 60*1024*1024*1024 # 60GB from 60 to the size you want in GB. For example, to create a 120GB volume, change the line to $global:VhdSize = 120*1024*1024*1024 # 120GB
  7. #7) In Powershell ISE, click File… Save to save the updated file.
  8. #8) In Powershell ISE, click File… Save As… and save a backup of the modified file. This file can be used to restore the customization after a re-install. To be safe, the file should not be used to re-apply the customization after an upgrade, since the file could have been changed as part of the upgrade. After upgrades, follow the steps above to re-apply customizations as necessary.
  9. #9) Restart Docker
  10. #10) From the Docker UI, select Reset… Reset to Factory Defaults. This action will rebuild your MobyLinuxVM with the new custom volume size. WARNING: this step wipes out all Images and Containers stored on the MobyLinuxVM!!!

I’ve tested this and it works for me. Hope it helps someone else out there until the feature is added to the Windows UI.


Thanks @vmarinelli this was a huge help!!!

Note to anyone else, if you do a

docker system df

I too am running oracle docker image server and was suffering the same issue. I wish I read @vmarinelli help earlier, but what I did was a bit more destructive.

I ran:

docker volume prune

Which actually deleted some vital storage data, but since it was temporary i could live with it.

Before I ran the command:

TYPE                TOTAL               ACTIVE              SIZE                RECLAIMABLE
Images              60                  37                  36.1GB              21.47GB (59%)
Containers          77                  2                   5.765GB             5.765GB (99%)
Local Volumes       26                  19                  14.75GB             13.49GB (91%)

then after:

$ docker system df
TYPE                TOTAL               ACTIVE              SIZE                RECLAIMABLE
Images              60                  39                  36.1GB              20.76GB (57%)
Containers          82                  7                   7.717GB             5.765GB (74%)
Local Volumes       21                  21                  3.177GB             0B (0%)

Anyways, I am still learning about docker, and next time I will want to try to expand the .vmdx file like @vmarinelli suggested.


I am running Docker Desktop with Docker Engine v19.03.8 and the file MobyLinux.ps1 looks a little different on my installation. There’s no $global:VhdSize line in my file, but a number of lines with local declarations for $VhdSize inside separate functions. I wasn’t sure which one to use, but I found a way to increase the disk space of the VM through Hyper-V Management. Here’s what I did:

  1. (1) open Hyper-V Manager
  2. (2) right click on the virtual machine MobyLinuxVM (or in my case DockerDesktopVM) and select settings
  3. (3) Select Hard Drive in de left hand pane
  4. (4) Click Edit in the right hand pane
  5. (5) Follow the wizzard to increase the VM storage to the desired size
  6. (6) If you now click ‘Inspect’ next ro the edit button you’ll see that the maximum storage for the VM has been updatdd. Container didn’t report an increase in storage yet so I followed up with the following steps
  7. (7) stop all running containers
  8. (8) remove all containers and images with the command docker system prune -a (this will leave container volumes intact!)
  9. (9) restart docker (edit: I checked whether the disk image sized in Docker Desktop settings matched the new size of my vm first, but I don’t think that really matters)
  10. (10) remake images and containers

After doing this my containers were up and running again and had access to the increased storage without having to delete their volumes.

1 Like