Skip to content

Instantly share code, notes, and snippets.

@iquiw
Last active September 10, 2016 13:28
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 iquiw/ed3bf1f8dbde2f769a03 to your computer and use it in GitHub Desktop.
Save iquiw/ed3bf1f8dbde2f769a03 to your computer and use it in GitHub Desktop.
Script to download docker.exe
#! /bin/sh
bundleURL=https://raw.githubusercontent.com/docker/toolbox/master/Dockerfile.windows
dockerBucket=get.docker.com
if [ -e docker ]; then
echo 'File or directory "docker" should not exist.'
exit 1
fi
latestVer=$(curl -fsSL "$bundleURL" | sed -n '/^ENV DOCKER_VERSION \(.*\)/s//\1/p')
if which docker >/dev/null 2>&1; then
currentVer=$(docker -v | sed -n '/Docker version \(.*\),.*/s//\1/p')
echo "local docker version: $currentVer"
if [ "$currentVer" = "$latestVer" ]; then
echo "local docker is the latest."
exit 0
fi
else
echo "local docker not found" 1>&2
fi
echo "Downloading docker-${latestVer}..."
curl -fSL -o docker.zip "https://test.docker.com/builds/Windows/x86_64/docker-${latestVer}.zip"
unzip docker.zip
mv docker/docker.exe $HOME/bin/
mv docker/dockerd.exe $HOME/bin/
mv docker/docker-proxy.exe $HOME/bin/
rmdir docker
rm docker.zip
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment