Manage Host Disk Volume Size

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.

4 Likes