Skip to content

Commit

Permalink
Switch from get.docker.com to download.docker.com
Browse files Browse the repository at this point in the history
  • Loading branch information
tianon committed May 11, 2017
1 parent 88c8e8f commit 5a196ca
Show file tree
Hide file tree
Showing 5 changed files with 58 additions and 62 deletions.
38 changes: 19 additions & 19 deletions 17.03/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,30 +1,30 @@
FROM alpine:3.5

RUN apk add --no-cache \
ca-certificates \
curl \
openssl
ca-certificates

ENV DOCKER_BUCKET get.docker.com
ENV DOCKER_CHANNEL stable
ENV DOCKER_VERSION 17.03.1-ce
ENV DOCKER_SHA256_x86_64 820d13b5699b5df63f7032c8517a5f118a44e2be548dd03271a86656a544af55
ENV DOCKER_SHA256_armel f05c733c22915b0c26d8b0390b26a026b33aaf7593d15475a6f86e1bbe1ddbe2
# TODO ENV DOCKER_SHA256

RUN set -ex; \
apkArch="$(apk --print-arch)"; \
case "$apkArch" in \
x86_64) dockerArch=x86_64 ;; \
armhf) dockerArch=armel ;; \
*) echo >&2 "error: unknown Docker static binary arch $apkArch"; exit 1 ;; \
esac; \
curl -fSL "https://${DOCKER_BUCKET}/builds/Linux/${dockerArch}/docker-${DOCKER_VERSION}.tgz" -o docker.tgz; \
# /bin/sh doesn't support ${!...} :(
sha256="DOCKER_SHA256_${dockerArch}"; sha256="$(eval "echo \$${sha256}")"; \
echo "${sha256} *docker.tgz" | sha256sum -c -; \
tar -xzvf docker.tgz; \
mv docker/* /usr/local/bin/; \
rmdir docker; \
# why we use "curl" instead of "wget":
# + wget -O docker.tgz https://download.docker.com/linux/static/stable/x86_64/docker-17.03.1-ce.tgz
# Connecting to download.docker.com (54.230.87.253:443)
# wget: error getting response: Connection reset by peer
apk add --no-cache --virtual .fetch-deps \
curl \
tar \
; \
curl -fL -o docker.tgz "https://download.docker.com/linux/static/${DOCKER_CHANNEL}/x86_64/docker-${DOCKER_VERSION}.tgz"; \
tar --extract \
--file docker.tgz \
--strip-components 1 \
--directory /usr/local/bin/ \
; \
rm docker.tgz; \
apk del .fetch-deps; \
dockerd -v; \
docker -v

COPY docker-entrypoint.sh /usr/local/bin/
Expand Down
7 changes: 5 additions & 2 deletions 17.03/dind/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,11 @@ RUN set -x \

ENV DIND_COMMIT 3b5fac462d21ca164b3778647420016315289034

RUN wget "https://raw.githubusercontent.com/docker/docker/${DIND_COMMIT}/hack/dind" -O /usr/local/bin/dind \
&& chmod +x /usr/local/bin/dind
RUN set -ex; \
apk add --no-cache --virtual .fetch-deps libressl; \
wget -O /usr/local/bin/dind "https://raw.githubusercontent.com/docker/docker/${DIND_COMMIT}/hack/dind"; \
chmod +x /usr/local/bin/dind; \
apk del .fetch-deps

COPY dockerd-entrypoint.sh /usr/local/bin/

Expand Down
38 changes: 19 additions & 19 deletions 17.05/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,30 +1,30 @@
FROM alpine:3.5

RUN apk add --no-cache \
ca-certificates \
curl \
openssl
ca-certificates

ENV DOCKER_BUCKET get.docker.com
ENV DOCKER_CHANNEL edge
ENV DOCKER_VERSION 17.05.0-ce
ENV DOCKER_SHA256_x86_64 340e0b5a009ba70e1b644136b94d13824db0aeb52e09071410f35a95d94316d9
ENV DOCKER_SHA256_armel 59bf474090b4b095d19e70bb76305ebfbdb0f18f33aed2fccd16003e500ed1b7
# TODO ENV DOCKER_SHA256

RUN set -ex; \
apkArch="$(apk --print-arch)"; \
case "$apkArch" in \
x86_64) dockerArch=x86_64 ;; \
armhf) dockerArch=armel ;; \
*) echo >&2 "error: unknown Docker static binary arch $apkArch"; exit 1 ;; \
esac; \
curl -fSL "https://${DOCKER_BUCKET}/builds/Linux/${dockerArch}/docker-${DOCKER_VERSION}.tgz" -o docker.tgz; \
# /bin/sh doesn't support ${!...} :(
sha256="DOCKER_SHA256_${dockerArch}"; sha256="$(eval "echo \$${sha256}")"; \
echo "${sha256} *docker.tgz" | sha256sum -c -; \
tar -xzvf docker.tgz; \
mv docker/* /usr/local/bin/; \
rmdir docker; \
# why we use "curl" instead of "wget":
# + wget -O docker.tgz https://download.docker.com/linux/static/stable/x86_64/docker-17.03.1-ce.tgz
# Connecting to download.docker.com (54.230.87.253:443)
# wget: error getting response: Connection reset by peer
apk add --no-cache --virtual .fetch-deps \
curl \
tar \
; \
curl -fL -o docker.tgz "https://download.docker.com/linux/static/${DOCKER_CHANNEL}/x86_64/docker-${DOCKER_VERSION}.tgz"; \
tar --extract \
--file docker.tgz \
--strip-components 1 \
--directory /usr/local/bin/ \
; \
rm docker.tgz; \
apk del .fetch-deps; \
dockerd -v; \
docker -v

COPY docker-entrypoint.sh /usr/local/bin/
Expand Down
7 changes: 5 additions & 2 deletions 17.05/dind/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,11 @@ RUN set -x \

ENV DIND_COMMIT 3b5fac462d21ca164b3778647420016315289034

RUN wget "https://raw.githubusercontent.com/docker/docker/${DIND_COMMIT}/hack/dind" -O /usr/local/bin/dind \
&& chmod +x /usr/local/bin/dind
RUN set -ex; \
apk add --no-cache --virtual .fetch-deps libressl; \
wget -O /usr/local/bin/dind "https://raw.githubusercontent.com/docker/docker/${DIND_COMMIT}/hack/dind"; \
chmod +x /usr/local/bin/dind; \
apk del .fetch-deps

COPY dockerd-entrypoint.sh /usr/local/bin/

Expand Down
30 changes: 10 additions & 20 deletions update.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,37 +27,27 @@ for version in "${versions[@]}"; do
continue
fi

dir="$version"
[ -d "$dir" ] || continue

channel='edge'
if [ "$rcVersion" != "$version" ]; then
bucket='test.docker.com'
else
bucket='get.docker.com'
channel='test'
elif \
minorVersion="${rcVersion##*.}" \
&& minorVersion="${minorVersion#0}" \
&& [ "$(( minorVersion % 3 ))" = '0' ] \
; then
channel='stable'
fi

(
set -x
#s/^(ENV DIND_COMMIT) .*/\1 '"$dindLatest"'/; # TODO once "Supported Docker versions" minimums at Docker 1.8+ (1.6 at time of this writing), bring this back again
sed -ri \
-e 's/^(ENV DOCKER_BUCKET) .*/\1 '"$bucket"'/' \
-e 's/^(ENV DOCKER_CHANNEL) .*/\1 '"$channel"'/' \
-e 's/^(ENV DOCKER_VERSION) .*/\1 '"$fullVersion"'/' \
-e 's/^(FROM docker):.*/\1:'"$version"'/' \
"$dir"/{,git/,dind/}Dockerfile
"$version"/{,git/,dind/}Dockerfile
)

for arch in \
x86_64 \
armel \
; do
url="https://$bucket/builds/Linux/$arch/docker-$fullVersion.tgz.sha256"
sha256="$(curl -fsSL "$url" | cut -d' ' -f1)"
(
set -x
sed -ri 's!^(ENV DOCKER_SHA256_'"$arch"') .*!\1 '"$sha256"'!' "$dir/Dockerfile"
)
done

travisEnv='\n - VERSION='"$version$travisEnv"
done

Expand Down

0 comments on commit 5a196ca

Please sign in to comment.