Skip to content

Instantly share code, notes, and snippets.

@duglin
Created Jul 18, 2016
Embed
What would you like to do?
(docker swarm leave --force;docker rm -f node1;docker service rm $(docker service ls -q))&>/dev/null
bold=$(tput bold)
normal=$(tput sgr0)
function doit() {
set +e
echo -n $bold"$ "
if [[ "$SKIP" == "" ]]; then read -s -n 1 ; fi
echo -n $*$normal" "
echo "$*" >> cmds
if [[ "$SKIP" == "" ]]; then read -s -n 1 ; fi
echo
$* 2>err >out
rc=$?
cat err out
[[ "$rc" == "0" ]] || exit
echo
set -e
}
set -e
doit docker swarm init --secret please
joinIP=$(grep 2377 out)
doit docker run --privileged -dti --name node1 --hostname node1 ibmdojo/dind
doit docker exec -ti node1 docker swarm join --secret please $joinIP
doit docker service create --name mini -p 80:80 ibmdojo/mini
doit docker service ls
echo -e $bold"Waiting for it to start...\\n"$normal
while !(docker service ls|grep "1/"&>/dev/null);do sleep 1;done
doit curl 127.0.0.1
doit docker service rm mini
doit docker rm -f node1
doit docker swarm leave --force
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment