Skip to content

Instantly share code, notes, and snippets.

@178inaba
Last active February 25, 2016 02:26
Show Gist options
  • Select an option

  • Save 178inaba/bf4be7bf6c903750f8ee to your computer and use it in GitHub Desktop.

Select an option

Save 178inaba/bf4be7bf6c903750f8ee to your computer and use it in GitHub Desktop.
docker reset script
#!/bin/bash
docker-machine restart default
if [[ $(docker-machine url default) =~ ^tcp://(.+):(.+)$ ]]; then
IP=${BASH_REMATCH[1]}
PORT=${BASH_REMATCH[2]}
else
exit 1
fi
until nc -z $IP $PORT
do
echo "wait..."
sleep 1
done
eval "$(docker-machine env default)"
# clean
docker stop $(docker ps -aq)
docker rm $(docker ps -aq)
docker rmi $(docker images -q)
# check
docker ps -a
docker images
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment