Last active
August 29, 2015 13:56
-
-
Save prologic/8947282 to your computer and use it in GitHub Desktop.
A quick script to setup a Docker environment against an already running and properly configured Docker host with some nice containers setup for you ready to go :)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Sets up a Docker Environment with the following components: | |
# | |
# - skydns (https://index.docker.io/u/crosbymichael/skydns/) | |
# - skydock (https://github.com/crosbymichael/skydock) | |
# - hipache (https://index.docker.io/_/hipache/) | |
self=$(basename ${0}) | |
if [[ "${#}" -eq 0 ]]; then | |
echo "Usage: ${self} <docker_hostname>" | |
exit 1 | |
fi | |
HOST=${1} | |
DOMAIN="local" | |
SOCKET="/run/docker.sock" | |
DOCKER0=$(ssh ${HOST} "ip -f inet -o addr show docker0 | cut -d ' ' -f 7 | cut -d '/' -f 1") | |
# Spin up skydns | |
echo "Spinning up skydns ..." | |
ssh ${HOST} "docker run -d -p ${DOCKER0}:53:53/udp -p 60053:53/udp -name skydns crosbymichael/skydns -nameserver 8.8.8.8:53 -domain ${DOMAIN}" | |
sleep 5 | |
# Spin up skydock | |
echo "Spinning up skydock ..." | |
ssh ${HOST} "docker run -d -v ${SOCKET}:/docker.sock -name skydock -link skydns:skydns crosbymichael/skydock -ttl 30 -environment dev -s /docker.sock -domain ${DOMAIN}" | |
# Spin up hipache | |
echo "Spinning up hipache ..." | |
ssh ${HOST} "docker run -d -name hipache -p 80:80 hipache" | |
ssh ${HOST} "docker ps" | |
echo "ALL DONE!" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Tested on:
TODO:
docker.sock
is.docker -d -dns 172.17.42.1 -H unix:///var/run/docker.sock -H tcp://0.0.0.0:4243