From 511859ef18129b3ac830c9f609f0324996e7c432 Mon Sep 17 00:00:00 2001 From: Davlet Panech Date: Wed, 27 Jan 2021 19:06:41 -0500 Subject: [PATCH] Dockerfile: fail in "yum install" on missing packages By default "yum install" ignores packages that can't be downloaded and return 0 to the shell. In a Dockerfile such falsely successful commands are cached by "docker build", so that the next time we run "docker build" the "yum install" is not even attempted: # this "succeeds" and gets cached during the first "docker build", # even if the URL returns an error (eg DNS error or HTTP 404). # During a second "docker build" this bringis back the FS layer # from the cache and doesn't attempt to re-download the package # from that URL RUN yum install python3 http://some/url.rpm ... This patch avoids the problem in case CENGN mirror is down. Change-Id: I65f2185ce8a1832f3fc1be4135b0a49653654b5b Closes-Bug: 1912682 Signed-off-by: Davlet Panech --- Dockerfile | 1 + 1 file changed, 1 insertion(+) diff --git a/Dockerfile b/Dockerfile index eba205a2..df4b420f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -43,6 +43,7 @@ COPY toCOPY/yum.repos.d/*.repo /etc/yum.repos.d/ COPY centos-mirror-tools/rpm-gpg-keys/RPM-GPG-KEY-EPEL-7 /etc/pki/rpm-gpg/ RUN rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY* && \ echo "http_caching=packages" >> /etc/yum.conf && \ + echo "skip_missing_names_on_install=0" >>/etc/yum.conf && \ # yum variables must be in lower case ; \ echo "$CENTOS_7_8_URL" >/etc/yum/vars/centos_7_8_url && \ echo "$EPEL_7_8_URL" >/etc/yum/vars/epel_7_8_url && \