Browse code

Refactor multi-arch support (especially for new mostly-official multi-arch official images)

See https://github.com/docker-library/official-images/blob/99433d2ca217bd9479169c93a20b6f6530f94856/README.md#architectures-other-than-amd64 for some context of where these images come from.

Signed-off-by: Andrew "Tianon" Page <admwiggin@gmail.com>

Tianon Gravi authored on 2016/01/05 14:50:15
Showing 8 changed files
... ...
@@ -23,16 +23,15 @@
23 23
 # the case. Therefore, you don't have to disable it anymore.
24 24
 #
25 25
 
26
-FROM ubuntu:14.04
27
-MAINTAINER Tianon Gravi <admwiggin@gmail.com> (@tianon)
26
+FROM ubuntu:trusty
28 27
 
29 28
 # add zfs ppa
30
-RUN	apt-key adv --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys E871F18B51E0147C77796AC81196BA81F6B0FC61
31
-RUN	echo deb http://ppa.launchpad.net/zfs-native/stable/ubuntu trusty main > /etc/apt/sources.list.d/zfs.list
29
+RUN apt-key adv --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys E871F18B51E0147C77796AC81196BA81F6B0FC61
30
+RUN echo deb http://ppa.launchpad.net/zfs-native/stable/ubuntu trusty main > /etc/apt/sources.list.d/zfs.list
32 31
 
33 32
 # add llvm repo
34
-RUN	apt-key adv --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys 15CF4D18AF4F7421
35
-RUN	echo deb http://llvm.org/apt/trusty/ llvm-toolchain-trusty main > /etc/apt/sources.list.d/llvm.list
33
+RUN apt-key adv --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys 6084F3CF814B57C1CF12EFD515CF4D18AF4F7421
34
+RUN echo deb http://llvm.org/apt/trusty/ llvm-toolchain-trusty main > /etc/apt/sources.list.d/llvm.list
36 35
 
37 36
 # Packaged dependencies
38 37
 RUN apt-get update && apt-get install -y \
... ...
@@ -72,19 +71,25 @@ RUN apt-get update && apt-get install -y \
72 72
 	&& ln -snf /usr/bin/clang++-3.8 /usr/local/bin/clang++
73 73
 
74 74
 # Get lvm2 source for compiling statically
75
-RUN git clone -b v2_02_103 https://git.fedorahosted.org/git/lvm2.git /usr/local/lvm2
75
+ENV LVM2_VERSION 2.02.103
76
+RUN mkdir -p /usr/local/lvm2 \
77
+	&& curl -fsSL "https://mirrors.kernel.org/sourceware/lvm2/LVM2.${LVM2_VERSION}.tgz" \
78
+		| tar -xzC /usr/local/lvm2 --strip-components=1
76 79
 # see https://git.fedorahosted.org/cgit/lvm2.git/refs/tags for release tags
77 80
 
78 81
 # Compile and install lvm2
79 82
 RUN cd /usr/local/lvm2 \
80
-	&& ./configure --enable-static_link \
83
+	&& ./configure \
84
+		--build="$(gcc -print-multiarch)" \
85
+		--enable-static_link \
81 86
 	&& make device-mapper \
82 87
 	&& make install_device-mapper
83 88
 # see https://git.fedorahosted.org/cgit/lvm2.git/tree/INSTALL
84 89
 
85 90
 # Install Go
86 91
 ENV GO_VERSION 1.5.2
87
-RUN curl -sSL  "https://storage.googleapis.com/golang/go${GO_VERSION}.linux-amd64.tar.gz" | tar -v -C /usr/local -xz
92
+RUN curl -fsSL "https://storage.googleapis.com/golang/go${GO_VERSION}.linux-amd64.tar.gz" \
93
+	| tar -xzC /usr/local
88 94
 ENV PATH /go/bin:/usr/local/go/bin:$PATH
89 95
 ENV GOPATH /go:/go/src/github.com/docker/docker/vendor
90 96
 
... ...
@@ -128,17 +133,17 @@ ENV PATH /osxcross/target/bin:$PATH
128 128
 # install seccomp
129 129
 # this can be changed to the ubuntu package libseccomp-dev if dockerinit is removed,
130 130
 # we need libseccomp.a (which the package does not provide) for dockerinit
131
-ENV SECCOMP_VERSION v2.2.3
131
+ENV SECCOMP_VERSION 2.2.3
132 132
 RUN set -x \
133
-	&& export SECCOMP_PATH=$(mktemp -d) \
134
-	&& git clone https://github.com/seccomp/libseccomp.git "$SECCOMP_PATH" \
133
+	&& export SECCOMP_PATH="$(mktemp -d)" \
134
+	&& curl -fsSL "https://github.com/seccomp/libseccomp/releases/download/v${SECCOMP_VERSION}/libseccomp-${SECCOMP_VERSION}.tar.gz" \
135
+		| tar -xzC "$SECCOMP_PATH" --strip-components=1 \
135 136
 	&& ( \
136 137
 		cd "$SECCOMP_PATH" \
137
-		&& git checkout "$SECCOMP_VERSION" \
138
-		&& ./autogen.sh \
139
-		&& ./configure --prefix=/usr \
138
+		&& ./configure --prefix=/usr/local \
140 139
 		&& make \
141 140
 		&& make install \
141
+		&& ldconfig \
142 142
 	) \
143 143
 	&& rm -rf "$SECCOMP_PATH"
144 144
 
... ...
@@ -196,7 +201,7 @@ RUN ln -sv $PWD/contrib/completion/bash/docker /etc/bash_completion.d/docker
196 196
 # Get useful and necessary Hub images so we can "docker load" locally instead of pulling
197 197
 COPY contrib/download-frozen-image-v2.sh /go/src/github.com/docker/docker/contrib/
198 198
 RUN ./contrib/download-frozen-image-v2.sh /docker-frozen-images \
199
-	busybox:latest@sha256:eb3c0d4680f9213ee5f348ea6d39489a1f85a318a2ae09e012c426f78252a6d2 \
199
+	busybox:latest@sha256:e4f93f6ed15a0cdd342f5aae387886fba0ab98af0a102da6276eaf24d6e6ade0 \
200 200
 	debian:jessie@sha256:24a900d1671b269d6640b4224e7b63801880d8e3cb2bcbfaa10a5dddcf4469ed \
201 201
 	hello-world:latest@sha256:8be990ef2aeb16dbcb9271ddfe2610fa6658d13f6dfb8bc72074cc1ca36966a7
202 202
 # see also "hack/make/.ensure-frozen-images" (which needs to be updated any time this list is)
... ...
@@ -204,8 +209,8 @@ RUN ./contrib/download-frozen-image-v2.sh /docker-frozen-images \
204 204
 # Download man page generator
205 205
 RUN set -x \
206 206
 	&& export GOPATH="$(mktemp -d)" \
207
-	&& git clone -b v1.0.4 https://github.com/cpuguy83/go-md2man.git "$GOPATH/src/github.com/cpuguy83/go-md2man" \
208
-	&& git clone -b v1.4 https://github.com/russross/blackfriday.git "$GOPATH/src/github.com/russross/blackfriday" \
207
+	&& git clone --depth 1 -b v1.0.4 https://github.com/cpuguy83/go-md2man.git "$GOPATH/src/github.com/cpuguy83/go-md2man" \
208
+	&& git clone --depth 1 -b v1.4 https://github.com/russross/blackfriday.git "$GOPATH/src/github.com/russross/blackfriday" \
209 209
 	&& go get -v -d github.com/cpuguy83/go-md2man \
210 210
 	&& go build -v -o /usr/local/bin/go-md2man github.com/cpuguy83/go-md2man \
211 211
 	&& rm -rf "$GOPATH"
... ...
@@ -220,12 +225,12 @@ RUN set -x \
220 220
 	&& rm -rf "$GOPATH"
221 221
 
222 222
 # Build/install the tool for embedding resources in Windows binaries
223
-ENV RSRC_COMMIT e48dbf1b7fc464a9e85fcec450dddf80816b76e0
223
+ENV RSRC_VERSION v2
224 224
 RUN set -x \
225
-	&& git clone https://github.com/akavel/rsrc.git /go/src/github.com/akavel/rsrc \
226
-	&& cd /go/src/github.com/akavel/rsrc \
227
-	&& git checkout -q $RSRC_COMMIT \
228
-	&& go install -v
225
+	&& export GOPATH="$(mktemp -d)" \
226
+	&& git clone --depth 1 -b "$RSRC_VERSION" https://github.com/akavel/rsrc.git "$GOPATH/src/github.com/akavel/rsrc" \
227
+	&& go build -v -o /usr/local/bin/rsrc github.com/akavel/rsrc \
228
+	&& rm -rf "$GOPATH"
229 229
 
230 230
 # Wrap all commands in the "docker-in-docker" script to allow nested containers
231 231
 ENTRYPOINT ["hack/dind"]
... ...
@@ -23,8 +23,7 @@
23 23
 # the case. Therefore, you don't have to disable it anymore.
24 24
 #
25 25
 
26
-FROM ioft/armhf-ubuntu:14.04
27
-MAINTAINER Govinda Fichtner <govinda.fichtner@googlemail.com> (@_beagile_)
26
+FROM armhf/ubuntu:trusty
28 27
 
29 28
 # Packaged dependencies
30 29
 RUN apt-get update && apt-get install -y \
... ...
@@ -40,6 +39,7 @@ RUN apt-get update && apt-get install -y \
40 40
 	git \
41 41
 	iptables \
42 42
 	jq \
43
+	net-tools \
43 44
 	libapparmor-dev \
44 45
 	libcap-dev \
45 46
 	libltdl-dev \
... ...
@@ -52,38 +52,47 @@ RUN apt-get update && apt-get install -y \
52 52
 	python-mock \
53 53
 	python-pip \
54 54
 	python-websocket \
55
-	s3cmd=1.1.0* \
56 55
 	xfsprogs \
57 56
 	tar \
58 57
 	--no-install-recommends
59 58
 
60 59
 # Get lvm2 source for compiling statically
61
-RUN git clone -b v2_02_103 https://git.fedorahosted.org/git/lvm2.git /usr/local/lvm2
60
+ENV LVM2_VERSION 2.02.103
61
+RUN mkdir -p /usr/local/lvm2 \
62
+	&& curl -fsSL "https://mirrors.kernel.org/sourceware/lvm2/LVM2.${LVM2_VERSION}.tgz" \
63
+		| tar -xzC /usr/local/lvm2 --strip-components=1
62 64
 # see https://git.fedorahosted.org/cgit/lvm2.git/refs/tags for release tags
63 65
 
64 66
 # Compile and install lvm2
65 67
 RUN cd /usr/local/lvm2 \
66
-	&& ./configure --enable-static_link \
68
+	&& ./configure \
69
+		--build="$(gcc -print-multiarch)" \
70
+		--enable-static_link \
67 71
 	&& make device-mapper \
68 72
 	&& make install_device-mapper
69 73
 # see https://git.fedorahosted.org/cgit/lvm2.git/tree/INSTALL
70 74
 
71 75
 # Install Go
72
-ENV GO_VERSION 1.4.3
76
+#ENV GO_VERSION 1.5.2
73 77
 # TODO update GO_TOOLS_COMMIT below when this updates to 1.5+
74
-RUN curl -fsSL https://golang.org/dl/go${GO_VERSION}.src.tar.gz | tar -v -C /usr/local -xz
78
+ENV GO_VERSION 1.4.3
79
+RUN curl -fsSL "https://github.com/hypriot/golang-armbuilds/releases/download/v${GO_VERSION}/go${GO_VERSION}.linux-armv7.tar.gz" \
80
+	| tar -xzC /usr/local
81
+# temporarily using Hypriot's tarballs while we wait for official 1.6+
82
+#RUN curl -fsSL https://golang.org/dl/go${GO_VERSION}.linux-arm6.tar.gz \
83
+#		| tar -xzC /usr/local
75 84
 ENV PATH /go/bin:/usr/local/go/bin:$PATH
76 85
 ENV GOPATH /go:/go/src/github.com/docker/docker/vendor
77 86
 
78 87
 # we're building for armhf, which is ARMv7, so let's be explicit about that
88
+ENV GOARCH arm
79 89
 ENV GOARM 7
80 90
 
81
-RUN cd /usr/local/go/src && ./make.bash --no-clean 2>&1
82
-
83 91
 # This has been commented out and kept as reference because we don't support compiling with older Go anymore.
84 92
 # ENV GOFMT_VERSION 1.3.3
85 93
 # RUN curl -sSL https://storage.googleapis.com/golang/go${GOFMT_VERSION}.$(go env GOOS)-$(go env GOARCH).tar.gz | tar -C /go/bin -xz --strip-components=2 go/bin/gofmt
86 94
 
95
+#ENV GO_TOOLS_COMMIT 823804e1ae08dbb14eb807afc7db9993bc9e3cc3
87 96
 # TODO update this sha when we upgrade to Go 1.5+
88 97
 ENV GO_TOOLS_COMMIT 069d2f3bcb68257b627205f0486d6cc69a231ff9
89 98
 # Grab Go's cover tool for dead-simple code coverage testing
... ...
@@ -94,6 +103,8 @@ RUN git clone https://github.com/golang/tools.git /go/src/golang.org/x/tools \
94 94
 	&& go install -v golang.org/x/tools/cmd/cover \
95 95
 	&& go install -v golang.org/x/tools/cmd/vet
96 96
 # Grab Go's lint tool
97
+#ENV GO_LINT_COMMIT 32a87160691b3c96046c0c678fe57c5bef761456
98
+# TODO update this sha when we upgrade to Go 1.5+
97 99
 ENV GO_LINT_COMMIT f42f5c1c440621302702cb0741e9d2ca547ae80f
98 100
 RUN git clone https://github.com/golang/lint.git /go/src/github.com/golang/lint \
99 101
 	&& (cd /go/src/github.com/golang/lint && git checkout -q $GO_LINT_COMMIT) \
... ...
@@ -102,17 +113,17 @@ RUN git clone https://github.com/golang/lint.git /go/src/github.com/golang/lint
102 102
 # install seccomp
103 103
 # this can be changed to the ubuntu package libseccomp-dev if dockerinit is removed,
104 104
 # we need libseccomp.a (which the package does not provide) for dockerinit
105
-ENV SECCOMP_VERSION v2.2.3
105
+ENV SECCOMP_VERSION 2.2.3
106 106
 RUN set -x \
107
-	&& export SECCOMP_PATH=$(mktemp -d) \
108
-	&& git clone https://github.com/seccomp/libseccomp.git "$SECCOMP_PATH" \
107
+	&& export SECCOMP_PATH="$(mktemp -d)" \
108
+	&& curl -fsSL "https://github.com/seccomp/libseccomp/releases/download/v${SECCOMP_VERSION}/libseccomp-${SECCOMP_VERSION}.tar.gz" \
109
+		| tar -xzC "$SECCOMP_PATH" --strip-components=1 \
109 110
 	&& ( \
110 111
 		cd "$SECCOMP_PATH" \
111
-		&& git checkout "$SECCOMP_VERSION" \
112
-		&& ./autogen.sh \
113
-		&& ./configure --prefix=/usr \
112
+		&& ./configure --prefix=/usr/local \
114 113
 		&& make \
115 114
 		&& make install \
115
+		&& ldconfig \
116 116
 	) \
117 117
 	&& rm -rf "$SECCOMP_PATH"
118 118
 
... ...
@@ -127,29 +138,21 @@ RUN set -x \
127 127
 	&& rm -rf "$GOPATH"
128 128
 
129 129
 # Install notary server
130
-# commented Notary temporary as we are waiting for an update of jose2go: https://github.com/docker/notary/issues/239
131
-#
132
-# ENV NOTARY_COMMIT 8e8122eb5528f621afcd4e2854c47302f17392f7
133
-# RUN set -x \
134
-# 	&& export GOPATH="$(mktemp -d)" \
135
-# 	&& git clone https://github.com/docker/notary.git "$GOPATH/src/github.com/docker/notary" \
136
-# 	&& (cd "$GOPATH/src/github.com/docker/notary" && git checkout -q "$NOTARY_COMMIT") \
137
-# 	&& GOPATH="$GOPATH/src/github.com/docker/notary/Godeps/_workspace:$GOPATH" \
138
-# 		go build -o /usr/local/bin/notary-server github.com/docker/notary/cmd/notary-server \
139
-# 	&& rm -rf "$GOPATH"
130
+ENV NOTARY_COMMIT f211b1826dde5fc8c117ccff9bb04ae458a8e3d0
131
+RUN set -x \
132
+	&& export GOPATH="$(mktemp -d)" \
133
+	&& git clone https://github.com/docker/notary.git "$GOPATH/src/github.com/docker/notary" \
134
+	&& (cd "$GOPATH/src/github.com/docker/notary" && git checkout -q "$NOTARY_COMMIT") \
135
+	&& GOPATH="$GOPATH/src/github.com/docker/notary/Godeps/_workspace:$GOPATH" \
136
+		go build -o /usr/local/bin/notary-server github.com/docker/notary/cmd/notary-server \
137
+	&& rm -rf "$GOPATH"
140 138
 
141 139
 # Get the "docker-py" source so we can run their integration tests
142
-ENV DOCKER_PY_COMMIT 139850f3f3b17357bab5ba3edfb745fb14043764
140
+ENV DOCKER_PY_COMMIT 57512760c83fbe41302891aa51e34a86f4db74de
143 141
 RUN git clone https://github.com/docker/docker-py.git /docker-py \
144 142
 	&& cd /docker-py \
145
-	&& git checkout -q $DOCKER_PY_COMMIT
146
-
147
-# Setup s3cmd config
148
-RUN { \
149
-		echo '[default]'; \
150
-		echo 'access_key=$AWS_ACCESS_KEY'; \
151
-		echo 'secret_key=$AWS_SECRET_KEY'; \
152
-	} > ~/.s3cfg
143
+	&& git checkout -q $DOCKER_PY_COMMIT \
144
+	&& pip install -r test-requirements.txt
153 145
 
154 146
 # Set user.email so crosbymichael's in-container merge commits go smoothly
155 147
 RUN git config --global user.email 'docker-dummy@example.com'
... ...
@@ -171,16 +174,16 @@ RUN ln -sv $PWD/contrib/completion/bash/docker /etc/bash_completion.d/docker
171 171
 # Get useful and necessary Hub images so we can "docker load" locally instead of pulling
172 172
 COPY contrib/download-frozen-image-v2.sh /go/src/github.com/docker/docker/contrib/
173 173
 RUN ./contrib/download-frozen-image-v2.sh /docker-frozen-images \
174
-	hypriot/armhf-busybox:latest@sha256:b0fc94dac9793ce3c35607b15012b4c7deca300963a7cc38ab440189ec81e2e7 \
175
-	hypriot/armhf-hello-world:latest@sha256:b618ec0cc3acf683e8d77ad6c5ec81546cddde2036eda9a78f628effdeca74cd \
176
-	hypriot/armhf-unshare:latest@sha256:8fede091760d2fb8b2d14cedffdd681c4575b02b1abeeb18dd79b754c62327db
174
+	armhf/busybox:latest@sha256:d98a7343ac750ffe387e3d514f8521ba69846c216778919b01414b8617cfb3d4 \
175
+	armhf/debian:jessie@sha256:094687129906d2a43cb4e5946ea379b5619c9ca8e4e27b3ba28b40f237a4150c \
176
+	armhf/hello-world:latest@sha256:161dcecea0225975b2ad5f768058212c1e0d39e8211098666ffa1ac74cfb7791
177 177
 # see also "hack/make/.ensure-frozen-images" (which needs to be updated any time this list is)
178 178
 
179 179
 # Download man page generator
180 180
 RUN set -x \
181 181
 	&& export GOPATH="$(mktemp -d)" \
182
-	&& git clone -b v1.0.4 https://github.com/cpuguy83/go-md2man.git "$GOPATH/src/github.com/cpuguy83/go-md2man" \
183
-	&& git clone -b v1.4 https://github.com/russross/blackfriday.git "$GOPATH/src/github.com/russross/blackfriday" \
182
+	&& git clone --depth 1 -b v1.0.4 https://github.com/cpuguy83/go-md2man.git "$GOPATH/src/github.com/cpuguy83/go-md2man" \
183
+	&& git clone --depth 1 -b v1.4 https://github.com/russross/blackfriday.git "$GOPATH/src/github.com/russross/blackfriday" \
184 184
 	&& go get -v -d github.com/cpuguy83/go-md2man \
185 185
 	&& go build -v -o /usr/local/bin/go-md2man github.com/cpuguy83/go-md2man \
186 186
 	&& rm -rf "$GOPATH"
... ...
@@ -195,12 +198,12 @@ RUN set -x \
195 195
 	&& rm -rf "$GOPATH"
196 196
 
197 197
 # Build/install the tool for embedding resources in Windows binaries
198
-ENV RSRC_COMMIT e48dbf1b7fc464a9e85fcec450dddf80816b76e0
198
+ENV RSRC_VERSION v2
199 199
 RUN set -x \
200
-	&& git clone https://github.com/akavel/rsrc.git /go/src/github.com/akavel/rsrc \
201
-	&& cd /go/src/github.com/akavel/rsrc \
202
-	&& git checkout -q $RSRC_COMMIT \
203
-	&& go install -v
200
+	&& export GOPATH="$(mktemp -d)" \
201
+	&& git clone --depth 1 -b "$RSRC_VERSION" https://github.com/akavel/rsrc.git "$GOPATH/src/github.com/akavel/rsrc" \
202
+	&& go build -v -o /usr/local/bin/rsrc github.com/akavel/rsrc \
203
+	&& rm -rf "$GOPATH"
204 204
 
205 205
 # Wrap all commands in the "docker-in-docker" script to allow nested containers
206 206
 ENTRYPOINT ["hack/dind"]
... ...
@@ -1,10 +1,27 @@
1
-# This file describes the standard way to build Docker, using docker
1
+# This file describes the standard way to build Docker on ppc64le, using docker
2 2
 #
3 3
 # Usage:
4 4
 #
5 5
 # # Assemble the full dev environment. This is slow the first time.
6 6
 # docker build -t docker -f Dockerfile.ppc64le .
7 7
 #
8
+# # Mount your source in an interactive container for quick testing:
9
+# docker run -v `pwd`:/go/src/github.com/docker/docker --privileged -i -t docker bash
10
+#
11
+# # Run the test suite:
12
+# docker run --privileged docker hack/make.sh test
13
+#
14
+# # Publish a release:
15
+# docker run --privileged \
16
+#  -e AWS_S3_BUCKET=baz \
17
+#  -e AWS_ACCESS_KEY=foo \
18
+#  -e AWS_SECRET_KEY=bar \
19
+#  -e GPG_PASSPHRASE=gloubiboulga \
20
+#  docker hack/release.sh
21
+#
22
+# Note: AppArmor used to mess with privileged mode, but this is no longer
23
+# the case. Therefore, you don't have to disable it anymore.
24
+#
8 25
 
9 26
 FROM ppc64le/gcc:5.3
10 27
 
... ...
@@ -12,37 +29,83 @@ FROM ppc64le/gcc:5.3
12 12
 RUN apt-get update && apt-get install -y \
13 13
 	apparmor \
14 14
 	aufs-tools \
15
+	automake \
16
+	bash-completion \
15 17
 	btrfs-tools \
16 18
 	build-essential \
19
+	createrepo \
17 20
 	curl \
21
+	dpkg-sig \
18 22
 	git \
19 23
 	iptables \
20 24
 	jq \
21 25
 	net-tools \
22 26
 	libapparmor-dev \
23 27
 	libcap-dev \
28
+	libltdl-dev \
24 29
 	libsqlite3-dev \
30
+	libsystemd-journal-dev \
31
+	libtool \
25 32
 	mercurial \
26
-	parallel \
33
+	pkg-config \
27 34
 	python-dev \
28 35
 	python-mock \
29 36
 	python-pip \
30 37
 	python-websocket \
38
+	xfsprogs \
39
+	tar \
31 40
 	--no-install-recommends
32 41
 
33
-RUN rm -rf /usr/local/lvm2
34
-RUN git clone --no-checkout git://git.fedorahosted.org/git/lvm2.git /usr/local/lvm2 && cd /usr/local/lvm2 && git checkout -q v2_02_103
35
-RUN curl -o /usr/local/lvm2/autoconf/config.guess 'http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD'
36
-RUN curl -o /usr/local/lvm2/autoconf/config.sub 'http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD'
42
+# Get lvm2 source for compiling statically
43
+ENV LVM2_VERSION 2.02.103
44
+RUN mkdir -p /usr/local/lvm2 \
45
+	&& curl -fsSL "https://mirrors.kernel.org/sourceware/lvm2/LVM2.${LVM2_VERSION}.tgz" \
46
+		| tar -xzC /usr/local/lvm2 --strip-components=1
47
+# see https://git.fedorahosted.org/cgit/lvm2.git/refs/tags for release tags
48
+
49
+# fix platform enablement in lvm2 to support ppc64le properly
50
+RUN set -e \
51
+	&& for f in config.guess config.sub; do \
52
+		curl -fsSL -o "/usr/local/lvm2/autoconf/$f" "http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=$f;hb=HEAD"; \
53
+	done
54
+# "arch.c:78:2: error: #error the arch code needs to know about your machine type"
37 55
 
38 56
 # Compile and install lvm2
39 57
 RUN cd /usr/local/lvm2 \
40
-	&& ./configure --enable-static_link \
58
+	&& ./configure \
59
+		--build="$(gcc -print-multiarch)" \
60
+		--enable-static_link \
41 61
 	&& make device-mapper \
42 62
 	&& make install_device-mapper
63
+# see https://git.fedorahosted.org/cgit/lvm2.git/tree/INSTALL
64
+
65
+# TODO install Go, using gccgo as GOROOT_BOOTSTRAP (Go 1.5+ supports ppc64le properly)
66
+# possibly a ppc64le/golang image?
43 67
 
68
+ENV PATH /go/bin:$PATH
44 69
 ENV GOPATH /go:/go/src/github.com/docker/docker/vendor
45 70
 
71
+# This has been commented out and kept as reference because we don't support compiling with older Go anymore.
72
+# ENV GOFMT_VERSION 1.3.3
73
+# RUN curl -sSL https://storage.googleapis.com/golang/go${GOFMT_VERSION}.$(go env GOOS)-$(go env GOARCH).tar.gz | tar -C /go/bin -xz --strip-components=2 go/bin/gofmt
74
+
75
+# TODO update this sha when we upgrade to Go 1.5+
76
+ENV GO_TOOLS_COMMIT 069d2f3bcb68257b627205f0486d6cc69a231ff9
77
+# Grab Go's cover tool for dead-simple code coverage testing
78
+# Grab Go's vet tool for examining go code to find suspicious constructs
79
+# and help prevent errors that the compiler might not catch
80
+RUN git clone https://github.com/golang/tools.git /go/src/golang.org/x/tools \
81
+	&& (cd /go/src/golang.org/x/tools && git checkout -q $GO_TOOLS_COMMIT) \
82
+	&& go install -v golang.org/x/tools/cmd/cover \
83
+	&& go install -v golang.org/x/tools/cmd/vet
84
+# Grab Go's lint tool
85
+ENV GO_LINT_COMMIT f42f5c1c440621302702cb0741e9d2ca547ae80f
86
+RUN git clone https://github.com/golang/lint.git /go/src/github.com/golang/lint \
87
+	&& (cd /go/src/github.com/golang/lint && git checkout -q $GO_LINT_COMMIT) \
88
+	&& go install -v github.com/golang/lint/golint
89
+
90
+
91
+# Install registry
46 92
 ENV REGISTRY_COMMIT ec87e9b6971d831f0eff752ddb54fb64693e51cd
47 93
 RUN set -x \
48 94
 	&& export GOPATH="$(mktemp -d)" \
... ...
@@ -63,12 +126,15 @@ RUN set -x \
63 63
 	&& rm -rf "$GOPATH"
64 64
 
65 65
 # Get the "docker-py" source so we can run their integration tests
66
-ENV DOCKER_PY_COMMIT 47ab89ec2bd3bddf1221b856ffbaff333edeabb4
66
+ENV DOCKER_PY_COMMIT 57512760c83fbe41302891aa51e34a86f4db74de
67 67
 RUN git clone https://github.com/docker/docker-py.git /docker-py \
68 68
 	&& cd /docker-py \
69 69
 	&& git checkout -q $DOCKER_PY_COMMIT \
70 70
 	&& pip install -r test-requirements.txt
71 71
 
72
+# Set user.email so crosbymichael's in-container merge commits go smoothly
73
+RUN git config --global user.email 'docker-dummy@example.com'
74
+
72 75
 # Add an unprivileged user to be used for tests which need it
73 76
 RUN groupadd -r docker
74 77
 RUN useradd --create-home --gid docker unprivilegeduser
... ...
@@ -77,12 +143,45 @@ VOLUME /var/lib/docker
77 77
 WORKDIR /go/src/github.com/docker/docker
78 78
 ENV DOCKER_BUILDTAGS apparmor selinux
79 79
 
80
-ENV IMAGEREPO ppc64le
80
+# Let us use a .bashrc file
81
+RUN ln -sfv $PWD/.bashrc ~/.bashrc
82
+
83
+# Register Docker's bash completion.
84
+RUN ln -sv $PWD/contrib/completion/bash/docker /etc/bash_completion.d/docker
85
+
86
+# Get useful and necessary Hub images so we can "docker load" locally instead of pulling
81 87
 COPY contrib/download-frozen-image-v2.sh /go/src/github.com/docker/docker/contrib/
82 88
 RUN ./contrib/download-frozen-image-v2.sh /docker-frozen-images \
83
-	$IMAGEREPO/busybox:latest \
84
-	$IMAGEREPO/hello-world:frozen \ 
85
-	$IMAGEREPO/unshare:latest	
89
+	ppc64le/busybox:latest@sha256:38bb82085248d5a3c24bd7a5dc146f2f2c191e189da0441f1c2ca560e3fc6f1b \
90
+	ppc64le/debian:jessie@sha256:74e06e6506b23cf8abd00250782838b2d19910824d8e7eab3d14dc1845ea10c6 \
91
+	ppc64le/hello-world:latest@sha256:186a40a9a02ca26df0b6c8acdfb8ac2f3ae6678996a838f977e57fac9d963974
92
+# see also "hack/make/.ensure-frozen-images" (which needs to be updated any time this list is)
93
+
94
+# Download man page generator
95
+RUN set -x \
96
+	&& export GOPATH="$(mktemp -d)" \
97
+	&& git clone --depth 1 -b v1.0.4 https://github.com/cpuguy83/go-md2man.git "$GOPATH/src/github.com/cpuguy83/go-md2man" \
98
+	&& git clone --depth 1 -b v1.4 https://github.com/russross/blackfriday.git "$GOPATH/src/github.com/russross/blackfriday" \
99
+	&& go get -v -d github.com/cpuguy83/go-md2man \
100
+	&& go build -v -o /usr/local/bin/go-md2man github.com/cpuguy83/go-md2man \
101
+	&& rm -rf "$GOPATH"
102
+
103
+# Download toml validator
104
+ENV TOMLV_COMMIT 9baf8a8a9f2ed20a8e54160840c492f937eeaf9a
105
+RUN set -x \
106
+	&& export GOPATH="$(mktemp -d)" \
107
+	&& git clone https://github.com/BurntSushi/toml.git "$GOPATH/src/github.com/BurntSushi/toml" \
108
+	&& (cd "$GOPATH/src/github.com/BurntSushi/toml" && git checkout -q "$TOMLV_COMMIT") \
109
+	&& go build -v -o /usr/local/bin/tomlv github.com/BurntSushi/toml/cmd/tomlv \
110
+	&& rm -rf "$GOPATH"
111
+
112
+# Build/install the tool for embedding resources in Windows binaries
113
+ENV RSRC_VERSION v2
114
+RUN set -x \
115
+	&& export GOPATH="$(mktemp -d)" \
116
+	&& git clone --depth 1 -b "$RSRC_VERSION" https://github.com/akavel/rsrc.git "$GOPATH/src/github.com/akavel/rsrc" \
117
+	&& go build -v -o /usr/local/bin/rsrc github.com/akavel/rsrc \
118
+	&& rm -rf "$GOPATH"
86 119
 
87 120
 # Wrap all commands in the "docker-in-docker" script to allow nested containers
88 121
 ENTRYPOINT ["hack/dind"]
... ...
@@ -1,47 +1,111 @@
1
-# This file describes the standard way to build Docker, using docker
1
+# This file describes the standard way to build Docker on s390x, using docker
2 2
 #
3 3
 # Usage:
4 4
 #
5 5
 # # Assemble the full dev environment. This is slow the first time.
6 6
 # docker build -t docker -f Dockerfile.s390x .
7 7
 #
8
+# # Mount your source in an interactive container for quick testing:
9
+# docker run -v `pwd`:/go/src/github.com/docker/docker --privileged -i -t docker bash
10
+#
11
+# # Run the test suite:
12
+# docker run --privileged docker hack/make.sh test
13
+#
14
+# # Publish a release:
15
+# docker run --privileged \
16
+#  -e AWS_S3_BUCKET=baz \
17
+#  -e AWS_ACCESS_KEY=foo \
18
+#  -e AWS_SECRET_KEY=bar \
19
+#  -e GPG_PASSPHRASE=gloubiboulga \
20
+#  docker hack/release.sh
21
+#
22
+# Note: AppArmor used to mess with privileged mode, but this is no longer
23
+# the case. Therefore, you don't have to disable it anymore.
24
+#
8 25
 
9
-FROM s390x/gcc:5.2
26
+FROM s390x/gcc:5.3
10 27
 
11 28
 # Packaged dependencies
12 29
 RUN apt-get update && apt-get install -y \
13 30
 	apparmor \
14 31
 	aufs-tools \
32
+	automake \
33
+	bash-completion \
15 34
 	btrfs-tools \
16 35
 	build-essential \
36
+	createrepo \
17 37
 	curl \
38
+	dpkg-sig \
18 39
 	git \
19 40
 	iptables \
20 41
 	jq \
21 42
 	net-tools \
22 43
 	libapparmor-dev \
23 44
 	libcap-dev \
45
+	libltdl-dev \
24 46
 	libsqlite3-dev \
47
+	libsystemd-journal-dev \
48
+	libtool \
25 49
 	mercurial \
26
-	parallel \
50
+	pkg-config \
27 51
 	python-dev \
28 52
 	python-mock \
29 53
 	python-pip \
30 54
 	python-websocket \
55
+	xfsprogs \
56
+	tar \
31 57
 	--no-install-recommends
32 58
 
33 59
 # Get lvm2 source for compiling statically
34
-RUN git clone -b v2_02_103 https://git.fedorahosted.org/git/lvm2.git /usr/local/lvm2
60
+ENV LVM2_VERSION 2.02.103
61
+RUN mkdir -p /usr/local/lvm2 \
62
+	&& curl -fsSL "https://mirrors.kernel.org/sourceware/lvm2/LVM2.${LVM2_VERSION}.tgz" \
63
+		| tar -xzC /usr/local/lvm2 --strip-components=1
35 64
 # see https://git.fedorahosted.org/cgit/lvm2.git/refs/tags for release tags
36 65
 
66
+# fix platform enablement in lvm2 to support s390x properly
67
+RUN set -e \
68
+	&& for f in config.guess config.sub; do \
69
+		curl -fsSL -o "/usr/local/lvm2/autoconf/$f" "http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=$f;hb=HEAD"; \
70
+	done
71
+# "arch.c:78:2: error: #error the arch code needs to know about your machine type"
72
+
37 73
 # Compile and install lvm2
38 74
 RUN cd /usr/local/lvm2 \
39
-	&& ./configure --enable-static_link \
75
+	&& ./configure \
76
+		--build="$(gcc -print-multiarch)" \
77
+		--enable-static_link \
40 78
 	&& make device-mapper \
41 79
 	&& make install_device-mapper
80
+# see https://git.fedorahosted.org/cgit/lvm2.git/tree/INSTALL
81
+
82
+# Note: Go comes from the base image (gccgo, specifically)
83
+# We can't compile Go proper because s390x isn't an officially supported architecture yet.
42 84
 
85
+ENV PATH /go/bin:$PATH
43 86
 ENV GOPATH /go:/go/src/github.com/docker/docker/vendor
44 87
 
88
+# This has been commented out and kept as reference because we don't support compiling with older Go anymore.
89
+# ENV GOFMT_VERSION 1.3.3
90
+# RUN curl -sSL https://storage.googleapis.com/golang/go${GOFMT_VERSION}.$(go env GOOS)-$(go env GOARCH).tar.gz | tar -C /go/bin -xz --strip-components=2 go/bin/gofmt
91
+
92
+# TODO update this sha when we upgrade to Go 1.5+
93
+ENV GO_TOOLS_COMMIT 069d2f3bcb68257b627205f0486d6cc69a231ff9
94
+# Grab Go's cover tool for dead-simple code coverage testing
95
+# Grab Go's vet tool for examining go code to find suspicious constructs
96
+# and help prevent errors that the compiler might not catch
97
+RUN git clone https://github.com/golang/tools.git /go/src/golang.org/x/tools \
98
+	&& (cd /go/src/golang.org/x/tools && git checkout -q $GO_TOOLS_COMMIT) \
99
+	&& go install -v golang.org/x/tools/cmd/cover \
100
+	&& go install -v golang.org/x/tools/cmd/vet
101
+# Grab Go's lint tool
102
+ENV GO_LINT_COMMIT f42f5c1c440621302702cb0741e9d2ca547ae80f
103
+RUN git clone https://github.com/golang/lint.git /go/src/github.com/golang/lint \
104
+	&& (cd /go/src/github.com/golang/lint && git checkout -q $GO_LINT_COMMIT) \
105
+	&& go install -v github.com/golang/lint/golint
106
+
107
+
108
+# Install registry
45 109
 ENV REGISTRY_COMMIT ec87e9b6971d831f0eff752ddb54fb64693e51cd
46 110
 RUN set -x \
47 111
 	&& export GOPATH="$(mktemp -d)" \
... ...
@@ -62,12 +126,15 @@ RUN set -x \
62 62
 	&& rm -rf "$GOPATH"
63 63
 
64 64
 # Get the "docker-py" source so we can run their integration tests
65
-ENV DOCKER_PY_COMMIT 47ab89ec2bd3bddf1221b856ffbaff333edeabb4
65
+ENV DOCKER_PY_COMMIT 57512760c83fbe41302891aa51e34a86f4db74de
66 66
 RUN git clone https://github.com/docker/docker-py.git /docker-py \
67 67
 	&& cd /docker-py \
68 68
 	&& git checkout -q $DOCKER_PY_COMMIT \
69 69
 	&& pip install -r test-requirements.txt
70 70
 
71
+# Set user.email so crosbymichael's in-container merge commits go smoothly
72
+RUN git config --global user.email 'docker-dummy@example.com'
73
+
71 74
 # Add an unprivileged user to be used for tests which need it
72 75
 RUN groupadd -r docker
73 76
 RUN useradd --create-home --gid docker unprivilegeduser
... ...
@@ -76,12 +143,45 @@ VOLUME /var/lib/docker
76 76
 WORKDIR /go/src/github.com/docker/docker
77 77
 ENV DOCKER_BUILDTAGS apparmor selinux
78 78
 
79
-ENV IMAGEREPO s390x
79
+# Let us use a .bashrc file
80
+RUN ln -sfv $PWD/.bashrc ~/.bashrc
81
+
82
+# Register Docker's bash completion.
83
+RUN ln -sv $PWD/contrib/completion/bash/docker /etc/bash_completion.d/docker
84
+
85
+# Get useful and necessary Hub images so we can "docker load" locally instead of pulling
80 86
 COPY contrib/download-frozen-image-v2.sh /go/src/github.com/docker/docker/contrib/
81 87
 RUN ./contrib/download-frozen-image-v2.sh /docker-frozen-images \
82
-	$IMAGEREPO/busybox:latest \
83
-	$IMAGEREPO/hello-world:frozen \
84
-	$IMAGEREPO/unshare:latest 
88
+	s390x/busybox:latest@sha256:dd61522c983884a66ed72d60301925889028c6d2d5e0220a8fe1d9b4c6a4f01b \
89
+	s390x/debian:jessie@sha256:3c478e199f60c877c00306356267798d32727dc3cd38512cdb4b060659ea9d20 \
90
+	s390x/hello-world:latest@sha256:780d80b3a7677c3788c0d5cd9168281320c8d4a6d9183892d8ee5cdd610f5699
91
+# see also "hack/make/.ensure-frozen-images" (which needs to be updated any time this list is)
92
+
93
+# Download man page generator
94
+RUN set -x \
95
+	&& export GOPATH="$(mktemp -d)" \
96
+	&& git clone --depth 1 -b v1.0.4 https://github.com/cpuguy83/go-md2man.git "$GOPATH/src/github.com/cpuguy83/go-md2man" \
97
+	&& git clone --depth 1 -b v1.4 https://github.com/russross/blackfriday.git "$GOPATH/src/github.com/russross/blackfriday" \
98
+	&& go get -v -d github.com/cpuguy83/go-md2man \
99
+	&& go build -v -o /usr/local/bin/go-md2man github.com/cpuguy83/go-md2man \
100
+	&& rm -rf "$GOPATH"
101
+
102
+# Download toml validator
103
+ENV TOMLV_COMMIT 9baf8a8a9f2ed20a8e54160840c492f937eeaf9a
104
+RUN set -x \
105
+	&& export GOPATH="$(mktemp -d)" \
106
+	&& git clone https://github.com/BurntSushi/toml.git "$GOPATH/src/github.com/BurntSushi/toml" \
107
+	&& (cd "$GOPATH/src/github.com/BurntSushi/toml" && git checkout -q "$TOMLV_COMMIT") \
108
+	&& go build -v -o /usr/local/bin/tomlv github.com/BurntSushi/toml/cmd/tomlv \
109
+	&& rm -rf "$GOPATH"
110
+
111
+# Build/install the tool for embedding resources in Windows binaries
112
+ENV RSRC_VERSION v2
113
+RUN set -x \
114
+	&& export GOPATH="$(mktemp -d)" \
115
+	&& git clone --depth 1 -b "$RSRC_VERSION" https://github.com/akavel/rsrc.git "$GOPATH/src/github.com/akavel/rsrc" \
116
+	&& go build -v -o /usr/local/bin/rsrc github.com/akavel/rsrc \
117
+	&& rm -rf "$GOPATH"
85 118
 
86 119
 # Wrap all commands in the "docker-in-docker" script to allow nested containers
87 120
 ENTRYPOINT ["hack/dind"]
... ...
@@ -1,14 +1,27 @@
1 1
 .PHONY: all binary build cross default docs docs-build docs-shell shell test test-docker-py test-integration-cli test-unit validate
2 2
 
3 3
 # get OS/Arch of docker engine
4
-DOCKER_ENGINE_OSARCH = $(shell docker version | grep 'OS/Arch' | tail -1 | cut -d':' -f2 | tr -d '[[:space:]]')
4
+DOCKER_OSARCH := $(shell bash -c 'source hack/make/.detect-daemon-osarch && echo $${DOCKER_ENGINE_OSARCH:+$$DOCKER_CLIENT_OSARCH}')
5 5
 # default for linux/amd64 and others
6
-DOCKER_FILE = Dockerfile
6
+DOCKERFILE := Dockerfile
7 7
 # switch to different Dockerfile for linux/arm
8
-ifeq ($(DOCKER_ENGINE_OSARCH),linux/arm)
9
-	DOCKER_FILE = Dockerfile.armhf
8
+ifeq ($(DOCKER_OSARCH), linux/arm)
9
+	DOCKERFILE := Dockerfile.armhf
10
+else
11
+ifeq ($(DOCKER_OSARCH), linux/arm64)
12
+	# TODO .arm64
13
+	DOCKERFILE := Dockerfile.armhf
14
+else
15
+ifeq ($(DOCKER_OSARCH), linux/ppc64le)
16
+	DOCKERFILE := Dockerfile.ppc64le
17
+else
18
+ifeq ($(DOCKER_OSARCH), linux/s390x)
19
+	DOCKERFILE := Dockerfile.s390x
10 20
 endif
11
-export DOCKER_FILE
21
+endif
22
+endif
23
+endif
24
+export DOCKERFILE
12 25
 
13 26
 # env vars passed through directly to Docker's build scripts
14 27
 # to allow things like `make DOCKER_CLIENTONLY=1 binary` easily
... ...
@@ -18,7 +31,7 @@ DOCKER_ENVS := \
18 18
 	-e DOCKER_CLIENTONLY \
19 19
 	-e DOCKER_DEBUG \
20 20
 	-e DOCKER_EXPERIMENTAL \
21
-	-e DOCKER_FILE \
21
+	-e DOCKERFILE \
22 22
 	-e DOCKER_GRAPHDRIVER \
23 23
 	-e DOCKER_REMAP_ROOT \
24 24
 	-e DOCKER_STORAGE_OPTS \
... ...
@@ -60,7 +73,7 @@ binary: build
60 60
 	$(DOCKER_RUN_DOCKER) hack/make.sh binary
61 61
 
62 62
 build: bundles
63
-	docker build -t "$(DOCKER_IMAGE)" -f $(DOCKER_FILE) .
63
+	docker build -t "$(DOCKER_IMAGE)" -f "$(DOCKERFILE)" .
64 64
 
65 65
 bundles:
66 66
 	mkdir bundles
67 67
new file mode 100644
... ...
@@ -0,0 +1,18 @@
0
+#!/bin/bash
1
+set -e
2
+
3
+# Retrieve OS/ARCH of docker daemon, eg. linux/amd64
4
+export DOCKER_ENGINE_OSARCH="$(docker version |tac|tac| awk '
5
+	$1 == "Client:" { server = 0; next }
6
+	$1 == "Server:" { server = 1; next }
7
+	server && $1 == "OS/Arch:" { print $2; exit }
8
+')"
9
+export DOCKER_ENGINE_GOOS="${DOCKER_ENGINE_OSARCH%/*}"
10
+export DOCKER_ENGINE_GOARCH="${DOCKER_ENGINE_OSARCH##*/}"
11
+
12
+# and the client, just in case
13
+export DOCKER_CLIENT_OSARCH="$(docker version |tac|tac| awk '
14
+	$1 == "Client:" { client = 1; next }
15
+	$1 == "Server:" { client = 0; next }
16
+	client && $1 == "OS/Arch:" { print $2; exit }
17
+')"
... ...
@@ -1,38 +1,32 @@
1 1
 #!/bin/bash
2 2
 set -e
3 3
 
4
-# image lists for different archs that should match what's in the Dockerfile (minus the explicit images IDs)
4
+# image list should match what's in the Dockerfile (minus the explicit images IDs)
5
+images=(
6
+	busybox:latest
7
+	debian:jessie
8
+	hello-world:latest
9
+)
10
+
11
+imagePrefix=
5 12
 case "$DOCKER_ENGINE_OSARCH" in
6 13
 	linux/arm)
7
-		images=(
8
-			hypriot/armhf-busybox:latest
9
-			hypriot/armhf-hello-world:latest
10
-			hypriot/armhf-unshare:latest
11
-		)
14
+		imagePrefix='armhf'
12 15
 		;;
13 16
 	linux/ppc64le)
14
-		images=(
15
-			ppc64le/busybox:latest
16
-			ppc64le/hello-world:frozen
17
-			ppc64le/unshare:latest
18
-		)
17
+		imagePrefix='ppc64le'
19 18
 		;;
20 19
 	linux/s390x)
21
-		images=(
22
-			s390x/busybox:latest
23
-			s390x/hello-world:frozen
24
-			s390x/unshare:latest
25
-		)
26
-		;;
27
-	*)
28
-		images=(
29
-			busybox:latest
30
-			debian:jessie
31
-			hello-world:latest
32
-		)
20
+		imagePrefix='s390x'
33 21
 		;;
34 22
 esac
35 23
 
24
+if [ "$imagePrefix" ]; then
25
+	for (( i = 0; i < ${#images[@]}; i++ )); do
26
+		images[$i]="$imagePrefix/${images[$i]}"
27
+	done
28
+fi
29
+
36 30
 if ! docker inspect "${images[@]}" &> /dev/null; then
37 31
 	hardCodedDir='/docker-frozen-images'
38 32
 	if [ -d "$hardCodedDir" ]; then
... ...
@@ -60,7 +54,7 @@ if ! docker inspect "${images[@]}" &> /dev/null; then
60 60
 					inCont = 0;
61 61
 				}
62 62
 			}
63
-		' ${DOCKER_FILE:="Dockerfile"} | sh -x
63
+		' "${DOCKERFILE:=Dockerfile}" | sh -x
64 64
 		# Do not use a subshell for the following command. Windows CI
65 65
 		# runs bash 3.x so will not trap an error in a subshell.
66 66
 		# http://stackoverflow.com/questions/22630363/how-does-set-e-work-with-subshells
... ...
@@ -68,35 +62,18 @@ if ! docker inspect "${images[@]}" &> /dev/null; then
68 68
 	fi
69 69
 fi
70 70
 
71
-# tag images to ensure that all integrations work with the defined image names
72
-# then remove original tags as these make problems with later tests (e.g., TestInspectApiImageResponse)
73
-case "$DOCKER_ENGINE_OSARCH" in
74
-	linux/arm)
75
-		docker tag hypriot/armhf-busybox:latest busybox:latest
76
-		docker tag hypriot/armhf-hello-world:latest hello-world:frozen
77
-		docker tag hypriot/armhf-unshare:latest jess/unshare:latest
78
-		docker rmi hypriot/armhf-busybox:latest
79
-		docker rmi hypriot/armhf-hello-world:latest
80
-		docker rmi hypriot/armhf-unshare:latest
81
-		;;
82
-	linux/ppc64le)
83
-		docker tag ppc64le/busybox:latest busybox:latest
84
-		docker tag ppc64le/hello-world:frozen hello-world:frozen
85
-		docker tag ppc64le/unshare:latest jess/unshare:latest
86
-		docker rmi ppc64le/busybox:latest
87
-		docker rmi ppc64le/hello-world:frozen
88
-		docker rmi ppc64le/unshare:latest
89
-		;;
90
-	linux/s390x)
91
-		docker tag s390x/busybox:latest busybox:latest
92
-		docker tag s390x/hello-world:frozen hello-world:frozen
93
-		docker tag s390x/unshare:latest jess/unshare:latest
94
-		docker rmi s390x/busybox:latest
95
-		docker rmi s390x/hello-world:frozen
96
-		docker rmi s390x/unshare:latest
97
-		;;
98
-	*)
99
-		docker tag hello-world:latest hello-world:frozen
100
-		docker rmi hello-world:latest
101
-		;;
102
-esac
71
+if [ "$imagePrefix" ]; then
72
+	for image in "${images[@]}"; do
73
+		target="${image#$imagePrefix/}"
74
+		if [ "$target" != "$image" ]; then
75
+			# tag images to ensure that all integrations work with the defined image names
76
+			docker tag "$image" "$target"
77
+			# then remove original tags as these make problems with later tests (e.g., TestInspectApiImageResponse)
78
+			docker rmi "$image"
79
+		fi
80
+	done
81
+fi
82
+
83
+# explicitly rename "hello-world:latest" to ":frozen" for the test that uses it
84
+docker tag hello-world:latest hello-world:frozen
85
+docker rmi hello-world:latest
... ...
@@ -1,12 +1,7 @@
1 1
 #!/bin/bash
2
+set -e
2 3
 
3
-# Retrieve OS/ARCH of docker daemon, eg. linux/amd64
4
-export DOCKER_ENGINE_OSARCH=$(docker version | grep 'OS/Arch' | tail -1 | cut -d':' -f2 | tr -d '[[:space:]]')
5
-# Retrieve OS of docker daemon, eg. linux
6
-export DOCKER_ENGINE_GOOS=$(echo $DOCKER_ENGINE_OSARCH | cut -d'/' -f1)
7
-# Retrieve ARCH of docker daemon, eg. amd64
8
-export DOCKER_ENGINE_GOARCH=$(echo $DOCKER_ENGINE_OSARCH | cut -d'/' -f2)
9
-
4
+bundle .detect-daemon-osarch
10 5
 bundle .ensure-emptyfs
11 6
 bundle .ensure-frozen-images
12 7
 bundle .ensure-httpserver