在CentOS系统中安装Docker的教程

2020-01-30 15:03:54于丽

# 在内核启动过程中装载根文件系统时有用
initrd /initramfs-2.6.32-358.el6.x86_64.img

常见错误解决范例:
例1
执行yum就开始报错:

复制代码
Error: Cannot retrieve metalink for repository: epel. Please ...

解决办法都是编辑/etc/yum.repos.d/epel.repo,把基础的恢复,镜像的地址注释掉
#baseurl  改成   baseurl
mirrorlist  改成  #mirrorlist

例2

复制代码
"DNS/Networking Errors inside the docker"
[root@localhost ~]# docker -dns="8.8.8.8" run centos:6.4 yum install hiphop-php
2013/08/21 07:53:05 POST /v1.4/containers/create
2013/08/21 07:53:05 POST /v1.4/containers/6d9fef14bd1a/start
2013/08/21 07:53:05 POST /v1.4/containers/6d9fef14bd1a/attach?logs=1&stderr=1&stdout=1&stream=1
Loaded plugins: fastestmirror
Error: Cannot retrieve repository metadata (repomd.xml) for repository: base. Please verify its path and try again
Could not retrieve mirrorlist http://mirrorlist.centos.org/?release=6&arch=x86_64&repo=os error was
14: PYCURL ERROR 6 - "Couldn't resolve host 'mirrorlist.centos.org'"

可以执行下面的命令来重置docker的运行环境,从而解决上述问题。

复制代码
pkill docker
iptables -t nat -F
ifconfig docker0 down
brctl delbr docker0
docker -d