Skip to content

Instantly share code, notes, and snippets.

@botchagalupe
Last active December 11, 2015 15:03
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 botchagalupe/94148b5bc7a6fb391e7c to your computer and use it in GitHub Desktop.
Save botchagalupe/94148b5bc7a6fb391e7c to your computer and use it in GitHub Desktop.

(https://github.com/docker/toolbox/releases)

(https://github.com/docker/toolbox/releases/download/v1.9.0-rc4/DockerToolbox-1.9.0-rc4.pkg)

  • docker 1.9.0-rc4
  • docker-machine 0.5.0-rc4
  • docker-compose 1.5.0-rc3
  • Kitematic 0.9.2
  • Boot2Docker ISO 1.9.0-rc4
  • VirtualBox 5.0.8

Quick Setup - see below for more detailed lab setup...

docker-machine create -d virtualbox mhl1
docker $(docker-machine config mhl1) run -d -p "8500:8500" -h "consul" progrium/consul -server -bootstrap
docker-machine create -d virtualbox --engine-opt="cluster-store=consul://$(docker-machine ip mhl1):8500" --engine-opt="cluster-advertise=eth1:0" mhl2
docker-machine create -d virtualbox --engine-opt="cluster-store=consul://$(docker-machine ip mhl1):8500" --engine-opt="cluster-advertise=eth1:0" mhl3
docker $(docker-machine config mhl2) network create -d overlay mhl-net

Voting Application

git clone https://github.com/docker/example-voting-app.gi
cd vote-apps/
eval "$(docker-machine env mhl2)"
docker-compose --x-networking up -d
docker-machine ip mhl2

curl http://192.168.99.101:5000
curl http://192.168.99.101:5001

Installation Toolbox Verification

docker-machine -version     # Should be 0.5.0-rc4 (952539d)

docker-machine create -d virtualbox mhl-consul

docker-machine ls 

docker-machine env mhl-consul

eval "$(docker-machine env mhl-consul)"

docker-machine ls          # Notice the star (active)

docker version             # Client ans Server should be 1.9.0-rc4

Setting up the KV Store Node

docker $(docker-machine config mhl-consul) run -d -p "8500:8500" -h "consul" progrium/consul -server -bootstrap

Create some Demo Nodes (connectining to the KV Store)

docker-machine create -d virtualbox --engine-opt="cluster-store=consul://$(docker-machine ip mhl-consul):8500" --engine-opt="cluster-advertise=eth1:0" mhl-demo0

docker-machine create -d virtualbox --engine-opt="cluster-store=consul://$(docker-machine ip mhl-consul):8500" --engine-opt="cluster-advertise=eth1:0" mhl-demo1

docker-machine ls 

Test out multi-host overlay

docker $(docker-machine config mhl-demo0) network create -d overlay my-app

docker $(docker-machine config mhl-demo0) network ls

docker $(docker-machine config mhl-demo1) network ls    

docker $(docker-machine config mhl-demo0) run -itd --name web --net=my-app nginx 

docker $(docker-machine config mhl-demo1) run -it --net=my-app busybox

## Inside the Container Shell 

hostname 

cat /etc/hosts    # Notice the entries for web and web.myapp

ping web

wget -qO- http://web

More fun Namespaces!!!

eval "$(docker-machine env mhl-demo0)"

docker-machine ls        #notice the new active machine is mhl-demo0

docker ps 

docker inspect -f '{{ .NetworkSettings.SandboxKey}}' web

docker-machine ssh mhl-demo0

sudo su

cd /var/run/docker/

ls netns

cd /var/run

ln -s /var/run/docker/netns netns

ip netns show

ip netns exec <namespace id> ip addr show eth0

(https://github.com/nerdalert/cloud-bandwidth)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment