Increase Disk Space on Docker Toolbox

前端 未结 4 1024
[愿得一人]
[愿得一人] 2021-02-01 03:11

I\'m trying to start some very large Containers on Docker Toolbox (about 18 GB in total). Unfortunately, I always get the error that there is not enough disk space. I have a 1TB

相关标签:
4条回答
  • 2021-02-01 03:18

    You can resize without having to delete the VM and recreate it. By default Docker Machine uses VirtualBox, which has the vboxmanage command line tool for working with VMs. You can use the modifymedium command to change disk size:

    vboxmanage modifymedium docker-vm.vdi --resize 100000
    
    0 讨论(0)
  • 2021-02-01 03:22

    In my case I had a lot of stopped containers, images and volumes - eating up space. Below commands help:

    docker container prune

    docker volume prune

    docker image prune

    0 讨论(0)
  • 2021-02-01 03:34

    I encountered the same issue. I was not prepared to lose any of my existing images or containers, so neither creating a new disk nor pruning my data were options for me. Here is how you can resize your disk without losing any of your data.

    Docker Toolbox creates a VMDK file per default. VirtualBox cannot resize this format. So, before you can resize it, you have to convert it to a VDI file.

    Go to your VirtualBox interface and detach the VMDK file from your "default" machine. Afterwards, clone the VMDK file to a VDI file:

    VBoxManage clonemedium disk --format VDI "C:\Users\me\.docker\machine\machines\default\disk.vmdk" "C:\Users\me\.docker\machine\machines\default\disk.vdi"
    

    You can now resize the VDI file. The last parameter of the following command specifies the new size in MB:

    VBoxManage modifyhd "C:\Users\me\.docker\machine\machines\default\disk.vdi" --resize 30720
    

    Now the disk is resized, but the partition is not. To resize the partition to fit the size of the disk, download GParted and create a new virtual machine. Attach your VDI disk and the GParted Live CD to the new machine. It will boot GParted and you can then use it to resize the partition to use the entire disk. There are a lot of detailed instructions how to do this on the internet, for example here. Once you have done that, shutdown the GParted VM.

    Attach the VDI file to your "default" machine. Run docker-machine start and it should boot your Docker machine with the resized virtual disk. If everything is working as intended, you can now delete the old VMDK file or archive it for backup purposes.

    0 讨论(0)
  • 2021-02-01 03:40

    OK, I finally found the solution:

    Open Docker Quickstart Terminal, remove the virtual docker-machine and add a new one:

     $ docker-machine rm default
     $ docker-machine create -d virtualbox --virtualbox-disk-size "100000" default
    
    0 讨论(0)
提交回复
热议问题