I just would like to try to install sshd in centos:latest image.
I try to install ‘passwd’, typing the command like this:
yum install passwd
But I have a error like this:
Failed to set locale, defaulting to C.UTF-8
CentOS-8 - AppStream 0.0 B/s | 0 B 00:30
Errors during downloading metadata for repository 'AppStream':
- Curl error (6): Couldn't resolve host name for http://mirrorlist.centos.org/?release=8&arch=x86_64&repo=AppStream&infra=container [Could not resolve host: mirrorlist.centos.org]
Error: Failed to download metadata for repo 'AppStream': Cannot prepare internal mirrorlist: Curl error (6): Couldn't resolve host name for http://mirrorlist.centos.org/?release=8&arch=x86_64&repo=AppStream&infra=container [Could not resolve host: mirrorlist.centos.org]
I don’t know why I can’t install using yum in docker container?
3
Answers
Just tested this on my local machine:
In docker container:
Add access to the host network using
--network host
Masquerading allows for docker ingress and egress:
Specifically allow incoming traffic on port 80/443 :
Reload firewall to apply permanent rules:
Restart docker :