Last active
November 23, 2018 08:27
-
-
Save asukakenji/b573363dfee5b29a1d342f8f1351d9f9 to your computer and use it in GitHub Desktop.
Pulling (downloading) all official releases (versions) of Go (Golang) images from Docker Hub
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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