首页 > 代码库 > 阿里云ECS安装Docker

阿里云ECS安装Docker

阿里云ESC系统信息,官方说2.6内核运行docker服务可能会不稳定;

$ uname -aLinux iZ259dixwg8Z 2.6.32-431.23.3.el6.x86_64 #1 SMP Thu Jul 31 17:20:51 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux

 

安装过程参考: http://www.docker.org.cn/book/install/install-docker-on-rhel-29.html

 

1. 本机未安装curl,需要先安装curl:

$ yum install curl

2. 执行docker安装脚本:

$ curl -sSL https://get.docker.com/ | sh 

3. 启动docker服务,启动过程中遇到了一些问题,本文后面统一说明;

$ service docker start

4. 查看docker版本:

$ docker versionClient version: 1.7.1Client API version: 1.19Go version (client): go1.4.2Git commit (client): 786b29dOS/Arch (client): linux/amd64Server version: 1.7.1Server API version: 1.19Go version (server): go1.4.2Git commit (server): 786b29dOS/Arch (server): linux/amd64

5. 验证安装,显示以下信息表示成功;

$ docker run hello-worldHello from Docker!This message shows that your installation appears to be working correctly.To generate this message, Docker took the following steps: 1. The Docker client contacted the Docker daemon. 2. The Docker daemon pulled the "hello-world" image from the Docker Hub. 3. The Docker daemon created a new container from that image which runs the    executable that produces the output you are currently reading. 4. The Docker daemon streamed that output to the Docker client, which sent it    to your terminal.To try something more ambitious, you can run an Ubuntu container with: $ docker run -it ubuntu bashShare images, automate workflows, and more with a free Docker ID: https://cloud.docker.com/For more examples and ideas, visit: https://docs.docker.com/engine/userguide/

 

service docker start启动过程中遇到的问题:

查看日志:

docker -h

或者:

cat /var/log/docker

 

问题1:

symbol dm_task_get_info_with_deferred_remove, version Base not defined in file     libdevmapper.so.1.02 with link time reference

解决方法:

$ yum upgrade device-mapper-libs

 

问题2:

Error starting daemon: Error initializing network controller: Error cr    eating default "bridge" network: cant find an address range for interface "docker0"

解决方法:

route del -net 172.16.0.0/12

如果想每次服务器启动都生效的话,可以修改下路由文件,去掉下面的172.16.0.0/12 via 10.170.247.247 dev eth0 这一行

/etc/sysconfig/network-scripts/route-eth0

10.0.0.0/8 via 10.170.247.247 dev eth0100.64.0.0/10 via 10.170.247.247 dev eth0172.16.0.0/12 via 10.170.247.247 dev eth0192.168.0.0/16 via 10.170.247.247 dev eth0

该问题具体原因查看:http://hanjianwei.com/2014/07/30/docker-on-aliyun/

 

问题3:在docker run hello-world的时候,设备突然重启了,重启后执行此命令显示

$ docker run hello-worldError response from daemon: EOF

解决方法:

$ docker pull hello-world

 

阿里云ECS安装Docker