This brief post explains how to use Docker in ExoGENI. The image built for this post is posted in ExoGENI Image Registry and also available in Flukes.
Name: Docker-v0.1 URL: http://geni-images.renci.org/images/ibaldin/docker/centos6.6-docker-v0.1/centos6.6-docker-v0.1.xml Hash: b2262a8858c9c200f9f43d767e7727a152a02248
This is a CentOS 6.6-based image with a Docker install on top. Note that this post is not meant to serve as a primer on Docker. For this you should consult Docker documentation.
Theory of operation
Docker is a platform to configure, ship and run applications. It uses thin containers to isolate dockers from each other. The docker daemon uses a devmapper to manage its disk space. By default Docker creates a sparse 100G file for data, and each docker can take up to 10G of disk space, which clearly is too large to run inside a VM, should it try to fill it up.
To ensure this doesn’t happen the ExoGENI Docker VM sizes each docker not to exceed 5G and the overall space given to Docker in its sparse file is limited to 20G. This setting is adjusted by editing a line in /etc/sysconfig/docker:
other_args="--storage-opt dm.basesize=5G --storage-opt dm.loopdatasize=20G"
If you wish to resize the amount of space available to your Docker, please edit this line accordingly and then do the following:
$ service docker stop $ cd /var/lib $ rm -rf docker $ service docker start
Please note that wiping out the /var/lib/docker directory as shown above will wipe out all images and containers you may have created so far. If you wish to save the image you created, please do
$ docker save -o image.tar
and save each image. Once Docker disk space is resized and restarted, you can reload the images back using docker load command.
Using the Docker image
You can simply boot some number of instances with the Docker image pointed above and start loading Dockers from Docker Hub or creating your own.
We recommend using the larger VM sizes, like XOLarge and XOExtraLarge to make sure you don’t run out of disk space.