centos
添加centos-docker源
centos7
sudo tee /etc/yum.repos.d/docker.repo <<-'EOF' [dockerrepo] name=Docker Repository baseurl=http://rnd-mirrors-langfang.huawei.com/docker/yum/repo/centos7/ enabled=1 gpgcheck=1 gpgkey=http://rnd-mirrors.huawei-langfang.com/docker/yum/gpg EOF
centos6
sudo tee /etc/yum.repos.d/docker.repo <<-'EOF' [dockerrepo] name=Docker Repository baseurl=http://rnd-mirrors-langfang.huawei.com/docker/yum/repo/centos6/ enabled=1 gpgcheck=1 gpgkey=http://rnd-mirrors-langfang.huawei.com/docker/yum/gpg EOF
安装
sudo yum update sudo yum install docker-engine
Yum系默认不启动的。需要启动shell sudo service docker start
Ubuntu
请先看ubuntu系列的help再来看docker的
更新Ubuntu内核(如果使用计算云,此步不是必须)
由于Docker需要在Linux Kernel 3.8及以上才可以很好的工作【本人在ubuntu12.04 lts 内核3.2也正常安装】。 强烈推荐在ubuntu14.04安装使用。 假如你一定要在低于这个kernel版本安装docker,使用如下命令行更新内核至3.8.0-25(升级后可能无法重启):shell sudo apt-get install linux-image-3.8.0-25-generic sudo apt-get install linux-headers-3.8.0-25-generic完成后重启电脑,通过命令 “uname -r” 来查看内核是否成功更新。
添加ubuntu-docker源
首先添加你的ubuntu-docker源: 打开你的/etc/apt/sources.list加入下面的源
12.04
deb http://rnd-mirrors-langfang.huawei.com/docker/apt/repo ubuntu-precise main
14.04
deb http://rnd-mirrors-langfang.huawei.com/docker/apt/repo ubuntu-trusty main
15.04
deb http://rnd-mirrors-langfang.huawei.com/docker/apt/repo ubuntu-vivid main
docker-gpg-key(已经更新为docker 1.8+)
复制这里的gpg-key 然后参考这个文章.
-----BEGIN PGP PUBLIC KEY BLOCK----- mQINBFWln24BEADrBl5p99uKh8+rpvqJ48u4eTtjeXAWbslJotmC/CakbNSqOb9o ddfzRvGVeJVERt/Q/mlvEqgnyTQy+e6oEYN2Y2kqXceUhXagThnqCoxcEJ3+KM4R mYdoe/BJ/J/6rHOjq7Omk24z2qB3RU1u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Ivnbk4NtKdnTGyTJCQ8+6i52s+C54PiNgfj2ieNn6oOR 7d+bNCcG1CdOYY+ZXVOcsjl73UYvtJrO0Rl/NpYERkZ5d/tzw4jZ6FCXgggA/Zxc jk6Y1ZvIm8Mt8wLRFH9Nww+FVsCtaCXJLP8DlJLASMD9rl5QS9Ku3u7ZNrr5HWXP HXITX660jglyshch6CWeiUATqjIAzkEQom/kEnOrvJAtkypRJ59vYQOedZ1sFVEL MXg2UCkD/FwojfnVtjzYaTCeGwFQeqzHmM241iuOmBYPeyTY5veF49aBJA1gEJOQ TvBR8Q== =Fm3p -----END PGP PUBLIC KEY BLOCK-----
更新apt
然后执行下面的命令就能安装最新的dockershell apt-get update apt-get install docker-engine如果需要安装某个版本的docker,运行下面这个命令即可shell apt-get install docker-engine=1.8 #此处1.8是例子切勿复制粘贴进行安装