How to fix: yum install with error in docker container? How to fix: yum install with error in docker container? docker docker

How to fix: yum install with error in docker container?


Just tested this on my local machine:

docker run -it -d --name test centos:latest;docker exec -it test /bin/bash;

In docker container:

[root@f3b8b3fe70df /]# yum update -y;[root@f3b8b3fe70df /]# yum install passwd;


Add access to the host network using --network host

docker run --network host -it -d --name test centos:latest


Masquerading allows for docker ingress and egress:

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

Specifically allow incoming traffic on port 80/443 :

     firewall-cmd --zone=public --add-port=443/tcp

Reload firewall to apply permanent rules:

     firewall-cmd --reload

Restart docker :

     systemctl restart docker