Docker on Mac

Trying to set up Docker on Mac, and it seems like Vagrant is a good option.

Some Docker-friendly Vagrant base boxes are listed here: https://github.com/phusion/open-vagrant-boxes#readme

Step zero:
install Vagrant and Virtualbox

Step one:

vagrant init phusion/ubuntu-12.04-amd64

Step two:
Modify the vagrant file. Pay attention to the network settings:

# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
VAGRANTFILE_API_VERSION = "2"

Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
 # Every Vagrant virtual environment requires a box to build off of.
 config.vm.box = "phusion/ubuntu-12.04-amd64"

 # Create a private network, which allows host-only access to the machine
 # using a specific IP.
 config.vm.network "private_network", ip: "192.168.50.4"

 # Share an additional folder to the guest VM. The first argument is
 # the path on the host to the actual folder. The second argument is
 # the path on the guest to mount the folder. And the optional third
 # argument is a set of non-required options.
 config.vm.synced_folder "../srv", "/vagrant_srv"

end

Step three, run this to install docker:

wget -q -O - https://get.docker.io/gpg | apt-key add -;
echo deb http://get.docker.io/ubuntu docker main > /etc/apt/sources.list.d/docker.list;
apt-get update -qq; apt-get install -q -y --force-yes lxc-docker; 

I am using private network from vagrant so that all ports are automatically forwarded so that you can visit
192.168.50.4:xyz however you want

Ref:
http://devo.ps/blog/2013/09/25/vagrant-docker-and-ansible-wtf.html
View story at Medium.com

Advertisements
Standard