Docker on Oracle Linux 8 with no access to the internet (yum error)

Those days, after deploying a brand new Oracle Linux 8 from OCI, I deployed docker-ce on it to install a new Oracle Database based on docker.

However, when trying to build the database docker image, I started to receive an strange error that was not happening on Oracle Linux 7. I was receiving an strange error "Could not resolve host: yum.oracle.com; Unknown error":

Loaded plugins: ovl
https://yum.oracle.com/repo/OracleLinux/OL7/latest/x86_64/repodata/repomd.xml: [Errno 14] curl#6 - "Could not resolve host: yum.oracle.com; Unknown error"
Trying other mirror.


 One of the configured repositories failed (Oracle Linux 7Server Latest (x86_64)),
 and yum doesn't have enough cached data to continue. At this point the only
 safe thing yum can do is fail. There are a few ways to work "fix" this:

     1. Contact the upstream for the repository and get them to fix the problem.

     2. Reconfigure the baseurl/etc. for the repository, to point to a working
        upstream. This is most often useful if you are using a newer
        distribution release than is supported by the repository (and the
        packages for the previous distribution release still work).

     3. Run the command with the repository temporarily disabled
            yum --disablerepo=ol7_latest ...

     4. Disable the repository permanently, so yum won't use it by default. Yum
        will then just ignore the repository until you permanently enable it
        again or use --enablerepo for temporary usage:

            yum-config-manager --disable ol7_latest
        or
            subscription-manager repos --disable=ol7_latest

     5. Configure the failing repository to be skipped, if it is unavailable.
        Note that yum will try to contact the repo. when it runs most commands,
        so will have to try and fail each time (and thus. yum will be be much
        slower). If it is a very temporary problem though, this is often a nice
        compromise:

            yum-config-manager --save --setopt=ol7_latest.skip_if_unavailable=true

failure: repodata/repomd.xml from ol7_latest: [Errno 256] No more mirrors to try.
https://yum.oracle.com/repo/OracleLinux/OL7/latest/x86_64/repodata/repomd.xml: [Errno 14] curl#6 - "Could not resolve host: yum.oracle.com; Unknown error"

Going further to try to understand the error, I started an Oracle Linux compute on docker and tried to access the internet on it:

# docker run -dit --name test oraclelinux:7-slim
# docker exec -it test bash
bash-4.2# yum install telnet
Loaded plugins: ovl
https://yum.oracle.com/repo/OracleLinux/OL7/latest/x86_64/repodata/repomd.xml: [Errno 14] curl#6 - "Could not resolve host: yum.oracle.com; Unknown error"
Trying other mirror.

So the same error...

After digging further, I found a similar issue happening on CentOS 8 which the solution was:

# firewall-cmd --zone=public --add-masquerade --permanent
# firewall-cmd --reload

"Reboot or restart dockerd, and both ingress and egress should work."

Source: https://serverfault.com/questions/987686/no-network-connectivity-to-from-docker-ce-container-on-centos-8

Have you enjoyed? Please leave a comment or give a 👍!

Leave a Reply

Your email address will not be published.