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

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 what wrong in installing using yum in docker container?

Two options spring to mind:

  1. mirrorlist.centos.org is down - nothing to do here except wait until it comes up again
  2. Your docker container can’t access the network

Why do you want passwd in a docker container anyway? Seems to against the whole principle of containers…

Umn… I just want to try to install ssh. passwd just a test I try to install using yum.

Thanks for help, where the problem is the second option. I set the network option in my container. At first thought, the network in container was connected outside…

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.