How to set the dynamic image size for docker-machine create
Hi, I'm trying to create a machine using docker-machine on CentOS:
$docker-machine create -d virtualbox dev -D
Part of output:
STDERR: Creating VirtualBox VM... Creating SSH key... Creating disk image... Creating 20000 MB hard disk image... Converting from raw image file="stdin" to file="/root/.docker/machine/machines/dev/disk.vmdk"... Creating dynamic image with size 20971520000 bytes (20000MB)... executing: /usr/bin/VBoxManage createvm --basefolder /root/.docker/machine/machines/dev --name dev --register STDOUT: STDERR: VBoxManage: error: Failed to create the VirtualBox object! VBoxManage: error: Code NS_ERROR_ABORT (0x80004004) - Operation aborted (extended info not available) VBoxManage: error: Most likely, the VirtualBox COM server is not running or failed to start.
Error creating machine: exit status 1 You will want to check the provider to make sure the machine and associated resources were properly removed.
Questions:
- How can I set/change the dynamic image size, 20000 MB is not affordable for me
- What is the problem with my case Appreciate your help!
Regards - Duy.
@duynguyenvan - Run docker-machine create --help, it will show you all the available options. In this case, you could use the --virtualbox-disk-size option. Example setting the disk to 2GB:
$ docker-machine create --virtualbox-disk-size 2000 -d virtualbox dev -D
Output you referenced:
STDERR:
Image cache does not exist, creating it at /Users/brint/.docker/machine/cache...
No default boot2docker iso found locally, downloading the latest release...
Downloading https://github.com/boot2docker/boot2docker/releases/download/v1.7.1/boot2docker.iso to /Users/brint/.docker/machine/cache/boot2docker.iso...
Creating VirtualBox VM...
Creating SSH key...
Creating disk image...
Creating 2000 MB hard disk image...
Converting from raw image file="stdin" to file="/Users/brint/.docker/machine/machines/dev/disk.vmdk"...
Creating dynamic image with size 2097152000 bytes (2000MB)...
You'll see that it only allocated 2,000MB as opposed to the default 20,000MB.
Thanks @brint. You can also refer to http://docs.docker.com/machine/reference/create/ for details on create`.
Thanks @brint and @ehazlett. I can change the image size now. Unfortunately the problem is still there as shown in the log below. Any idea please? STDERR: Creating VirtualBox VM... Creating SSH key... Creating disk image... Creating 2000 MB hard disk image... Converting from raw image file="stdin" to file="/root/.docker/machine/machines/dev/disk.vmdk"... Creating dynamic image with size 2097152000 bytes (2000MB)... executing: /usr/bin/VBoxManage createvm --basefolder /root/.docker/machine/machines/dev --name dev --register STDOUT: STDERR: VBoxManage: error: Failed to create the VirtualBox object! VBoxManage: error: Code NS_ERROR_ABORT (0x80004004) - Operation aborted (extended info not available) VBoxManage: error: Most likely, the VirtualBox COM server is not running or failed to start.
Error creating machine: exit status 1 You will want to check the provider to make sure the machine and associated resources were properly removed.