准备机器###
- 从已有的linux虚拟机中复制一个,注意重新生成网卡
- 修改机器ip:
sudo vi /etc/sysconfig/network-scripts/ifcfg-eth0
- 修改hostname:
sudo vi /etc/sysconfig/networks
- 删除系统的网卡信息:
sudo rm -rf /etc/udev/rules.d/70-persistent-net.rules
- 重启系统:
reboot
- 创建docker用户:
useradd docker
- 为docker用户创建密码:
passwd docker
- 添加docker到sudoers:
vi /etc/sudoers
安装docker###
- 使用docker用户登录
- 检查centos kernel版本
cat /etc/issue
和uname -r
docker 要求centos6以上,kernel的版本必须2.6.32-431或者更高 - 启用EPEL软件库
sudo yum install http://ftp.riken.jp/Linux/fedora/epel/6/i386/epel-release-6-8.noarch.rpm
- 安装docker:
sudo yum install docker-io
- 启动docker:
sudo service docker start
,查看docker状态,发现问题docker 已死,但 pid 文件仍存
,说明启动报错了,查看日志tail -f /var/log/docker
time="2015-03-09T16:05:29+08:00" level="info" msg="+job serveapi(unix:///var/run/docker.sock)" time="2015-03-09T16:05:29+08:00" level="info" msg="WARNING: You are running linux kernel version 2.6.32-431.el6.x86_64, which might be unstable running docker. Please upgrade your kernel to 3.8.0." time="2015-03-09T16:05:29+08:00" level="info" msg="Listening for HTTP on unix (/var/run/docker.sock)" /usr/bin/docker: relocation error: /usr/bin/docker: symbol dm_task_get_info_with_deferred_remove, version Base not defined in file libdevmapper.so.1.02 with link time reference
- 解决办法:
yum install device-mapper-event-libs
- 重启docker,然后在查看docker状态