Search code examples
dockervirtualboxboot2docker

Way to increase Boot2Docker volume size or alternative to install docker images locally


I'm running a docker-machine to create a local docker host on OS X 10.10 Yosemite.

This following script below creates the host, then logins in remotely to run a second script which installs images which have previously been saved to local compressed files.

#!/bin/bash

docker-machine create --driver virtualbox docker-stack
docker-machine docker-machine docker-stack-local 
stackip="$(docker-machine ip docker-stack-local)"
sshpass -p "tcuser" scp -v -r docker_images/ docker@"${stackip}":/home/docker/
cat ssh_after.sh | docker-machine ssh ec2-01 sh

The ssh_after.sh script calls installation of the desired docker images:

#!/bin/bash

cd /home/docker/test
gunzip -c anaconda_bak.tgz | docker load
gunzip -c r-base_bak.tgz | docker load
gunzip -c git_bak.tgz | docker load
gunzip -c mariadb.tgz | docker load

Unfortunately, the virtual machine volume created is too small to transfer over the files (> 1 GB).

It is a known issue: http://docs.docker.com/articles/b2d_volume_resize/

However, the solution involves calling GUI tools and is not suitable for scripting purposes.

I would like to find a way to either:

  1. resize the image afterward using a bash script, or
  2. find a way to pipe the stdout stream of the compressed files through ssh to pass to docker load

Note, a modified script works fine for other docker-machine drivers, including AWS EC2 instances.

The solution must involve installing local docker images, not pulling from a repository of any kind.

To avoid confusion, this is about getting image files into the docker host, not mounting files into a docker container instance.


Solution

  • You should be able to use docker-machine create --virtualbox-disk-size "35000". Add the disk size option to your build script.