Using a build-arg so that we don't have to specify it for each
`apt-get install`, and to preserve that the `DEBIAN_FRONTEND` is
preserved in the image itself (which changes the default behavior,
and can be surprising if the image is run interactively).`
With this patch, some (harmless, but possibly confusing) errors
are no longer printed during build, for example:
```patch
Unpacking libgcc1:armhf (1:6.3.0-18+deb9u1) ...
Selecting previously unselected package libc6:armhf.
Preparing to unpack .../04-libc6_2.24-11+deb9u4_armhf.deb ...
-debconf: unable to initialize frontend: Dialog
-debconf: (TERM is not set, so the dialog frontend is not usable.)
-debconf: falling back to frontend: Readline
Unpacking libc6:armhf (2.24-11+deb9u4) ...
Selecting previously unselected package libgcc1:arm64.
Preparing to unpack .../05-libgcc1_1%3a6.3.0-18+deb9u1_arm64.deb ...
Unpacking libgcc1:arm64 (1:6.3.0-18+deb9u1) ...
Selecting previously unselected package libc6:arm64.
Preparing to unpack .../06-libc6_2.24-11+deb9u4_arm64.deb ...
-debconf: unable to initialize frontend: Dialog
-debconf: (TERM is not set, so the dialog frontend is not usable.)
-debconf: falling back to frontend: Readline
```
Looks like some output is now also printed on stdout instead of stderr
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
... | ... |
@@ -26,6 +26,7 @@ |
26 | 26 |
|
27 | 27 |
ARG CROSS="false" |
28 | 28 |
ARG GO_VERSION=1.12.7 |
29 |
+ARG DEBIAN_FRONTEND=noninteractive |
|
29 | 30 |
|
30 | 31 |
FROM golang:${GO_VERSION}-stretch AS base |
31 | 32 |
ARG APT_MIRROR |
... | ... |
@@ -33,6 +34,7 @@ RUN sed -ri "s/(httpredir|deb).debian.org/${APT_MIRROR:-deb.debian.org}/g" /etc/ |
33 | 33 |
&& sed -ri "s/(security).debian.org/${APT_MIRROR:-security.debian.org}/g" /etc/apt/sources.list |
34 | 34 |
|
35 | 35 |
FROM base AS criu |
36 |
+ARG DEBIAN_FRONTEND |
|
36 | 37 |
# Install CRIU for checkpoint/restore support |
37 | 38 |
ENV CRIU_VERSION 3.11 |
38 | 39 |
# Install dependency packages specific to criu |
... | ... |
@@ -85,6 +87,7 @@ RUN set -x \ |
85 | 85 |
&& rm -rf "$GOPATH" |
86 | 86 |
|
87 | 87 |
FROM base AS frozen-images |
88 |
+ARG DEBIAN_FRONTEND |
|
88 | 89 |
RUN apt-get update && apt-get install -y --no-install-recommends \ |
89 | 90 |
ca-certificates \ |
90 | 91 |
jq \ |
... | ... |
@@ -102,6 +105,7 @@ RUN /download-frozen-image-v2.sh /build \ |
102 | 102 |
FROM base AS cross-false |
103 | 103 |
|
104 | 104 |
FROM base AS cross-true |
105 |
+ARG DEBIAN_FRONTEND |
|
105 | 106 |
RUN dpkg --add-architecture armhf |
106 | 107 |
RUN dpkg --add-architecture arm64 |
107 | 108 |
RUN dpkg --add-architecture armel |
... | ... |
@@ -116,11 +120,13 @@ RUN if [ "$(go env GOHOSTARCH)" = "amd64" ]; then \ |
116 | 116 |
FROM cross-${CROSS} as dev-base |
117 | 117 |
|
118 | 118 |
FROM dev-base AS runtime-dev-cross-false |
119 |
+ARG DEBIAN_FRONTEND |
|
119 | 120 |
RUN apt-get update && apt-get install -y --no-install-recommends \ |
120 | 121 |
libapparmor-dev \ |
121 | 122 |
libseccomp-dev \ |
122 | 123 |
&& rm -rf /var/lib/apt/lists/* |
123 | 124 |
FROM cross-true AS runtime-dev-cross-true |
125 |
+ARG DEBIAN_FRONTEND |
|
124 | 126 |
# These crossbuild packages rely on gcc-<arch>, but this doesn't want to install |
125 | 127 |
# on non-amd64 systems. |
126 | 128 |
# Additionally, the crossbuild-amd64 is currently only on debian:buster, so |
... | ... |
@@ -155,6 +161,7 @@ COPY hack/dockerfile/install/$INSTALL_BINARY_NAME.installer ./ |
155 | 155 |
RUN PREFIX=/build ./install.sh $INSTALL_BINARY_NAME |
156 | 156 |
|
157 | 157 |
FROM dev-base AS containerd |
158 |
+ARG DEBIAN_FRONTEND |
|
158 | 159 |
RUN apt-get update && apt-get install -y --no-install-recommends \ |
159 | 160 |
btrfs-tools \ |
160 | 161 |
&& rm -rf /var/lib/apt/lists/* |
... | ... |
@@ -194,6 +201,7 @@ COPY hack/dockerfile/install/$INSTALL_BINARY_NAME.installer ./ |
194 | 194 |
RUN PREFIX=/build ./install.sh $INSTALL_BINARY_NAME |
195 | 195 |
|
196 | 196 |
FROM dev-base AS tini |
197 |
+ARG DEBIAN_FRONTEND |
|
197 | 198 |
RUN apt-get update && apt-get install -y --no-install-recommends \ |
198 | 199 |
cmake \ |
199 | 200 |
vim-common \ |
... | ... |
@@ -212,6 +220,7 @@ COPY ./contrib/dockerd-rootless.sh /build |
212 | 212 |
|
213 | 213 |
# TODO: Some of this is only really needed for testing, it would be nice to split this up |
214 | 214 |
FROM runtime-dev AS dev |
215 |
+ARG DEBIAN_FRONTEND |
|
215 | 216 |
RUN groupadd -r docker |
216 | 217 |
RUN useradd --create-home --gid docker unprivilegeduser |
217 | 218 |
# Let us use a .bashrc file |