[root@localhost mysql]# docker build -f mysql -t mysql:v1.1 .
One of the configured repositories failed (centos),
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=centos ...
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 centos
or
subscription-manager repos --disable=centos
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=centos.skip_if_unavailable=true
failure: repodata/repomd.xml from centos: [Errno 256] No more mirrors to try.
ftp://192.168.180.30/centos/repodata/repomd.xml: [Errno 14] curl#7 - "Failed connect to 192.168.180.30:21; Connection refused"
ftp://192.168.180.30/centos/repodata/repomd.xml: [Errno 14] curl#7 - "Failed connect to 192.168.180.30:21; Connection refused"
ftp://192.168.180.30/centos/repodata/repomd.xml: [Errno 14] curl#7 - "Failed connect to 192.168.180.30:21; Connection refused"
ftp://192.168.180.30/centos/repodata/repomd.xml: [Errno 14] curl#7 - "Failed connect to 192.168.180.30:21; Connection refused"
ftp://192.168.180.30/centos/repodata/repomd.xml: [Errno 14] curl#7 - "Failed connect to 192.168.180.30:21; Connection refused"
ftp://192.168.180.30/centos/repodata/repomd.xml: [Errno 14] curl#7 - "Failed connect to 192.168.180.30:21; Connection refused"
ftp://192.168.180.30/centos/repodata/repomd.xml: [Errno 14] curl#7 - "Failed connect to 192.168.180.30:21; Connection refused"
ftp://192.168.180.30/centos/repodata/repomd.xml: [Errno 14] curl#7 - "Failed connect to 192.168.180.30:21; Connection refused"
ftp://192.168.180.30/centos/repodata/repomd.xml: [Errno 14] curl#7 - "Failed connect to 192.168.180.30:21; Connection refused"
ftp://192.168.180.30/centos/repodata/repomd.xml: [Errno 14] curl#7 - "Failed connect to 192.168.180.30:21; Connection refused"
The command '/bin/sh -c yum install -y mariadb-server' returned a non-zero code: 1
目测是CentOS的yum源配置有问题,导致执行安装mariadb-server时报连接超时的错误。解决方案有两种:
1、换国内CentOS镜像源,https://zhuanlan.zhihu.com/p/281504830,请按当前基础系统镜像版本调整。
2、mariadb有官方镜像,可以只把你的自定义配置文件构建镜像时替换默认的;或者直接用官方镜像,启动时持载配置文件等。
如有帮助,欢迎采纳!