Docker Community Forums

Share and learn in the Docker community.

Yum update fails on centos latest docker image

yum update fails when i try to yum update as follows :slight_smile:

FROM centos

MAINTAINER “sveerla”

RUN dnf clean all && rm -r /var/cache/dnf && dnf upgrade -y && dnf update -y


Errors during downloading metadata for repository ‘AppStream’:

I ran into this problem attempting to run the same Dockerfile, which fetched several software packages using yum, on two different platforms; one macOS, the other an Ubuntu 16.04-based Linux OS (elementaryOS Loki), both using the official packages from

My theory is that the Linux package is just more restrictive out of the box, security-wise, than the macOS one. Maybe this is configurable with some kind of /etc/something config file, but I don’t have the expertise with Docker to say for sure. EDIT: See my comment below.

What I can say is there was no additional configuration required for me on macOS (10.11 El Capitan); just docker build . worked fine, and yum processes from the Dockerfile were able to reach all the remote repositories.

In the Ubuntu-derived Linux distro, however, it was necessary to use

docker build --network host .
followed by

docker run -it --network host
when I wanted to run a process inside that image which required internet access.

This may be the case for other Debian-derived systems as well.

There are, of course, security considerations which need to be taken into account when allowing a long-running Docker container to communicate through the host network adapter, unrestricted, and one would do well to review the appropriate documentation in that regard.