Skip to content

krak3n/salted-docker-vagrant

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Salted Vagrant Docker

This will automatically install Docker using Salt. Docker will be automatically configured to accecept connections from anywhere which means you can alias docker on OSX to talk directly with docker on the Vagrant virtual machine.

Dependencies

For this to work you need the following installed.

  • VirtualBox
  • Vagrant 1.1+
  • Vagrant vagrant-vbguest plugin: vagrant plugin install vagrant-vbguest
  • Vagrant vagrant-salt plugin: vagrant plugin install vagrant-salt

Usage

Clone the repo and vagrant up && vagrant reload

OSX Docker Alias

We have to install docker on OSX, obviously it won't work as docker does not yet support OSX, however we still need the docker binary so we can connect to docker running on Vagrant.

Install Go Using HomeBrew

brew update
brew install go

Install Docker on OSX

Follow these steps to install docker binary on OSX.

  • cd ~
  • mkdir tmp
  • export GOPATH=`pwd`/tmp
  • mkdir -p $GOPATH/src/github.com/dotcloud
  • cd $GOPATH/src/github.com/dotcloud
  • git clone https://github.com/dotcloud/docker.git
  • cd $GOPATH/src/github.com/dotcloud/docker
  • git checkout v0.6.3
  • go get -v github.com/dotcloud/docker/...
  • sudo cp $GOPATH/bin/docker /usr/local/bin
  • cd ~ && rm -rf tmp

Now run docker version and you should see the following:

$ docker version
Go version (client): go1.1.2
2013/10/06 15:42:01 dial unix /var/run/docker.sock: no such file or directory

Seeing as we don't have docker running on OSX this is totally expected,

Alias Docker on OSX

All we need to do now is just create an alias on OSX, add this to your ~/.bashrc or ~/.zshrc etc.

alias docker='docker -H tcp://127.0.1:4243/'

Reload your shell and run docker version you should see the following output:

$ docker version
Go version (client): go1.1.2
Server version: 0.6.3
Git commit (server): b0a49a3
Go version (server): go1.1.2
Last stable version: 0.6.3

Now give docker run -i -t ubuntu /bin/bash a try ;)

Credits

Thanks to these articles:

About

A Salt Vagrant which installs docker and configures docker so it can be aliased on OSX.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published