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 <davlet.panech@windriver.com>
This commit is contained in:
Davlet Panech 2021-01-27 19:06:41 -05:00
parent da804d9ca7
commit 511859ef18
1 changed files with 1 additions and 0 deletions

View File

@ -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 && \