Slightly Modified from here: http://www.siliconfidential.com/articles/docker-coreos-osx/ with some additions from: https://coreos.com/os/docs/latest/customizing-docker.html
- Install Vagrant (https://www.vagrantup.com/downloads.html), VirtualBox (https://www.virtualbox.org/wiki/Downloads)
- Install docker:
wget http://get.docker.io/builds/Darwin/x86_64/docker-latest
chmod +x docker-latest
sudo mv docker-latest /usr/local/bin/docker
Now get the fancy Vagrantfile from the original folks:
git clone https://github.com/coreos/coreos-vagrant/
cd coreos-vagrant
This is where these instructions diverge from the original.
If you want to share folders between the host and the guest:
$shared_folders = {'/path/on/host' => '/path/on/guest', '/home/foo/app' => '/app'}
Forward the docker tcp port to the guest so your local docker client can connect (you will have to add this line):
$expose_docker_tcp=2375
Forward any other ports:
$forwarded_ports = { port_on_host => port_on_guest, port_on_host => port_on_guest }
Bring the box up (You will be prompted for your admin password so it can nfs mount the shared directories):
vagrant up
Connect to the box:
vagrant ssh
Create a file on the vagrant box /etc/systemd/system/docker-tcp.socket
:
[Unit]
Description=Docker Socket for the API
[Socket]
ListenStream=2375
BindIPv6Only=both
Service=docker.service
[Install]
WantedBy=sockets.target
Enable docker and the port listening:
sudo systemctl enable docker-tcp.socket
sudo systemctl stop docker
sudo systemctl start docker-tcp.socket
sudo systemctl start docker
Now from your mac:
export DOCKER_HOST=127.0.0.1:2375
Did it work (From the mac command line)?
docker run ubuntu /bin/echo hello world
docker ps -a