Skip to content

Instantly share code, notes, and snippets.

Created Jul 18, 2016
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
$* 2>err >out
cat err out
[[ "$rc" == "0" ]] || exit
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
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