首先提权到root
su -
查看内核版本(内核版本要大于3.10)
#uname -r
3.13.0-32-generic
更新软件包的信息,确保HTTPS和CA证书安装和工作
# apt-get update
# apt-get install apt-transport-https ca-certificates
增加GPGkey
apt-key adv \
--keyserver hkp://ha.pool.sks-keyservers.net:80 \
--recv-keys 58118E89F3A912897C070ADBF76221572C52609D
增加docker源
Precise 12.04 (LTS) deb https://apt.dockerproject.org/repo ubuntu-precise main
Trusty 14.04 (LTS) deb https://apt.dockerproject.org/repo ubuntu-trusty main
Wily 15.10 deb https://apt.dockerproject.org/repo ubuntu-wily main
Xenial 16.04 (LTS) deb https://apt.dockerproject.org/repo ubuntu-xenial main
echo "deb https://apt.dockerproject.org/repo ubuntu-trusty mai" | tee /etc/apt/sources.list.d/docker.list
更新apt包索引
apt-get update
安装推荐的软件包(14.04以上)
apt-get install linux-image-extra-$(uname -r) linux-image-extra-virtual
如果是12.04或以下必须先更新内核并重启
apt-get install linux-image-generic-lts-trusty
reboot
安装docker
apt-get install docker-engine
将用户添加到用户组
sudo gpasswd -a ${USER} docker
配置本地源
curl -sSL https://get.daocloud.io/daotools/set_mirror.sh | sh -s http://e36cbad3.m.daocloud.io
启动docker守护进程
service docker start