环境: centos7 docker-ce 20.10.8
问题
Sending build context to Docker daemon 1.035MB
Step 1/3 : FROM centos:centos7.7.1908
---> 08d05d1d5859
Step 2/3 : ADD nginx-1.16.1.tar.gz /usr/local/src
---> Using cache
---> e9795e2a839c
Step 3/3 : RUN rpm -ivh http://mirrors.aliyun.com/epel/epel-release-latest-7.noarch.rpm && yum install -y gcc gcc-c++ automake pcre pcre-devel zlib zlib-devel openssl ousr/local/src && ./configure --prefix=/usr/local/nginx --with-http_sub_module && make && make install
---> Running in 479e8da1e610
Retrieving http://mirrors.aliyun.com/epel/epel-release-latest-7.noarch.rpm
curl: (6) Could not resolve host: mirrors.aliyun.com; Unknown error
error: skipping http://mirrors.aliyun.com/epel/epel-release-latest-7.noarch.rpm - transfer failed
发现安装不了软件
# 产生原因.可能是因为宿主机的dns在docker中不可用导致的.所以换个dns
# 解决方式
在docker的配置文件中添加
{
"dns": ["119.29.29.29"]
}
然后重启docker即可