recipe for running docker on a mac laptop, with a java+node instance
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
Dockerfile
README.md
Vagrantfile
build-docker-image.sh
setup.sh
teardown.sh
vagrant-provision.sh

README.md

docker-layercake

Docker is a pretty cool system for making fast-starting Linux containers. The containers start from a snapshot image, run some task or server, then self-destruct when finished, so each image always starts from a fresh state.

Docker requires lxc (Linux containers), which requires Linux, so on a development laptop (Mac OS X), you need to start up a Linux VM using VirutalBox. This requires a layer cake:

This project is just a set of scripts and config files to create a docker image on my laptop that can run java and node.js programs. The image could be used as a base for building an image with your favorite server or tool.

I am not using this in production, and neither is the company I work for. Consider it a recipe that worked for me.

You must have VirtualBox and vagrant installed. (They're available from the above links.)

The scripts, in order from the outside in:

  • setup.sh - Initialize a VM using vagrant.
  • Vagrantfile - Configuration for using "raring" ubuntu (required for docker)
  • vagrant-provision.sh - Run by vagrant, on the VM, to update the current VirtualBox integration
  • setup.sh - Reboots the VM to use the new VirtualBox integration, then asks vagrant to run:
  • build-docker-image.sh - Installs docker, fetches the base ubuntu image for docker, installs java and node.js, and saves the new image as "robey/base".

There's also a script to clean up if you want a fresh start, or are tired of playing:

  • teardown.sh - Destroy the VM and remove any trace of it from vagrant

You'll know this all works when you do:

$ vagrant ssh -c "sudo docker run robey/base java -version"

and:

$ vagrant ssh -c "sudo docker run robey/base node --version"