docker容器中---------------yum 安装出现的报错错误操作记录

17 篇文章 3 订阅
13 篇文章 0 订阅

1. docker容器中 yum 安装出现的报错

Loaded plugins: fastestmirror, langpacks
Could not retrieve mirrorlist http://mirrorlist.centos.org/?release=7&arch=x86_64&repo=os error was
12: Timeout on http://mirrorlist.centos.org/?release=7&arch=x86_64&repo=os: (28, ‘Connection timed out after 30215 milliseconds’)

One of the configured repositories failed (Unknown),
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. Disable the repository, 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 <repoid>

 4. 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=<repoid>.skip_if_unavailable=true

Cannot find a valid baseurl for repo: base/7/x86_64

解决方法:
先检查下 ping 网络,看看是不是网络问题
1.可能是网络出现问题
vim etc/sysconfig/network-scripts/ifcfg-ens33
修改配置ONBOOT=no改为ONBOOT=yes
wq保存退出
service network restart重启网络服务

2.修改下DNS 配置
vim /etc/resolv.conf
nameserver 改成 8.8.8.8或者自己虚拟机的IP

2. CentOS7 docker run 以后 出现网络问题WARNING: IPv4 forwarding is disabled. Networking will not work.

解决方法:
添加路由转发功能
vi /etc/sysctl.conf
添加net.ipv4.ip_forward=1
重启网络服务以及docker服务systemctl restart network
重新docker run

3.Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?

Job for docker.service failed because start of the service was attempted too often

docker version

在这里插入图片描述
解决方式

cd /etc/docker
ls
没有 daemon.json 就手动添加
把daemon.json改为daemon.conf。使用mv命令修改后,docker启动正常。这个方式是不正确的

设置/etc/docker/daemon.json 文件,将其中关于registry的配置删除后重启docker就好。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值