1、在centos下安装docker,首先查看内核版本信息
[joe@SZ~]$
uname-r
3.2.69
2、安装EPEL Repository
rpm -iUvh http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
3、更新安装包
yum update -y
N.B:如果安装过程中报
CannotretrieveMetalinkforrepository:epel错误,可以编辑/etc/yum.repos.d/epel.repo,
将其中的baseurl启用,mirrorlist注释掉。
4、安装docker
yum install docker-io -y
N.B. :安装完成后执行docker ps -a 命令报:
AreyoutryingtoconnecttoaTLS-enableddaemonwithoutTLS
5、启动docker daemon
service docker start
可以将docker配置成server boot时启动
chkconfig docker on
6、执行docker ps -a命令报:
CannotconnecttotheDockerdaemon.Is'docker-d'runningonthishost?
执行docker -d命令后又报错误:
[
root@SZjoe]#docker-d
INFO[0000]ListeningforHTTPonunix(/var/run/docker.sock)
WARN[0000]Youarerunninglinuxkernelversion3.2.69,whichmightbeunstablerunningdocker.Pleaseupgradeyourkernelto3.10.0.
INFO[0000][graphdriver]usingpriorstoragedriver"devicemapper"
WARN[0000]Runningmodprobebridgenf_natFailedwithmessage:,error:exitstatus1
FATA[0000]Errorstartingdaemon:Errorinitializingnetworkcontroller:Errorcreatingdefault"bridge"network:FailedtocreateNATchain:FailedtoinjectdockerinPREROUTINGchain:iptablesFailed:iptables-tnat-APREROUTING-maddrtype--dst-typeLOCAL-jDOCKER:iptables:Nochain/target/matchbythatname.
(exitstatus1)
后来发现重启之后就好了。
参考网址:
http://www.liquidweb.com/kb/how-to-install-docker-on-centos-6/
http://blog.163.com/qiushuhui1989@126/blog/static/27011089201541424753139/
http://www.centoscn.com/CentOS/config/2015/0416/5189.html
http://stackoverflow.com/questions/29704059/docker-are-you-trying-to-connect-to-a-tls-enabled-daemon-without-tls
https://docs.docker.com/engine/reference/commandline/cli/
https://github.com/docker/docker/issues/9745
http://stackoverflow.com/questions/29824469/docker-error-in-linux-mint-17/29825797#29825797