Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Pulling (downloading) all official releases (versions) of Go (Golang) images from Docker Hub
#!/bin/bash
# The first release available is golang:1.2.0
major=1
minor=2
patch=0
while true
do
while true
do
while true
do
if [ $patch -eq 0 ]
then
if [ $minor -eq 0 ]
then
# Pull golang:1, golang:2, etc.
# which is an alias of the latest golang:1.x.x, golang:2.x.x, etc.
docker pull golang:${major}
fi
# Pull golang:1.2, golang:1.3, etc.
# which is an alias of the latest golang:1.2.x, golang:1.3.x, etc.
docker pull golang:${major}.${minor}
fi
# Pull golang:1.2.0, golang:1.2.1, etc.
docker pull golang:${major}.${minor}.${patch}
if [ $? -ne 0 ]
then
break
fi
: $((++patch))
done
if [ $patch -eq 0 ]
then
break
fi
: $((++minor))
patch=0
done
if [ $minor -eq 0 ]
then
break
fi
: $((++major))
minor=0
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment