Skip to content

Instantly share code, notes, and snippets.

@amenophis
Forked from chadrien/README.md
Last active August 29, 2015 14:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save amenophis/e22c86eeaece882d7edb to your computer and use it in GitHub Desktop.
Save amenophis/e22c86eeaece882d7edb to your computer and use it in GitHub Desktop.

Init boot2docker

Create boot2docker instance and start it

$ boot2docker init --dhcp=false --hostip=172.16.0.1
$ boot2docker up

Configure the instance

$ boot2docker ssh
$ sudo cp /opt/bootlocal.sh /Users/{username}/

Edit the bootlocal.sh now in your home to add this line:

ifconfig eth1 172.16.0.11 netmask 255.255.0.0

Now create a profile file with this content:

DOCKER_TLS=no
EXTRA_ARGS="--bip=172.17.42.1/16 --dns=172.17.42.1"

Go back into the boot2docker ssh

$ sudo cp /Users/{username}/bootlocal.sh /var/lib/boot2docker/
$ sudo cp /Users/{usename}/profile /var/lib/boot2docker/profile
$ exit
$ boot2docker restart
$ sudo route -n add 172.17.0.0/16 172.16.0.11

Check that it worked:

$ ping -c1 172.16.0.11
PING 172.16.0.11 (172.16.0.11): 56 data bytes
64 bytes from 172.16.0.11: icmp_seq=0 ttl=64 time=3.484 ms

--- 172.16.0.11 ping statistics ---
1 packets transmitted, 1 packets received, 0.0% packet loss
round-trip min/avg/max/stddev = 3.484/3.484/3.484/0.000 ms

$ docker version
Client version: 1.6.2
Client API version: 1.18
Go version (client): go1.4.2
Git commit (client): 7c8fca2
OS/Arch (client): darwin/amd64
Server version: 1.6.2
Server API version: 1.18
Go version (server): go1.4.2
Git commit (server): 7c8fca2
OS/Arch (server): linux/amd64
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment