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

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 

 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=.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

docker容器中---------------yum 安装出现的报错错误操作记录_第1张图片
解决方式

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

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

你可能感兴趣的:(linux,容器,docker,云计算,linux,服务器)