(原)ubuntu14及ubuntu16中安装docker

转载请注明出处:html

http://www.cnblogs.com/darkknightzh/p/5653739.htmllinux

参考网址:docker

http://blog.csdn.net/yangzhenping/article/details/43671843ubuntu

https://docs.docker.com/engine/installation/linux/ubuntulinux/ide

http://blog.csdn.net/xundh/article/details/46441403ui

 

1. 因为老版本的docker支持的命令不多,于是须要卸载老版本的dockerspa

http://blog.csdn.net/yangzhenping/article/details/43671843.net

sudo docker -v  
sudo apt-get remove docker 

老版本的docker支持的命令:code

 

2. ubuntu14上面从新安装新版本的dockerserver

http://blog.csdn.net/xundh/article/details/46441403

直接使用以下命令便可

wget -qO- https://get.docker.com/ | sh

q后面是大写字母O

说明:有时候赋值上面这句话,就是提示有问题,去上面的网址复制,就能够执行。。。

 

3. ubuntu16上面从新安装新版本的docker

参考docker官方文档(https://docs.docker.com/engine/installation/linux/ubuntulinux/

说明:a. 上面网址有16.04,15.10,14.04,12.04的安装步骤。接下来只说在ubuntu16上怎么安装。

b. ubuntu内核最低为3.10.使用以下命令查看内核版本:

uname -r

1更新apt源:

① ensure that APT works with the https method, and that CA certificates are installed

终端中输入以下命令:

sudo apt-get update
sudo apt-get install apt-transport-https ca-certificates

② 增长新的GPG key

sudo apt-key adv --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys 58118E89F3A912897C070ADBF76221572C52609D

③ 打开/etc/apt/sources.list.d/docker.list文件,删除里面的全部内容(须要超级管理员权限);若是不存在,建立。

④ 在③中的文件中增长 entry,并保存该文件:

deb https://apt.dockerproject.org/repo ubuntu-xenial main

注意:其余版本中的请查看上面的网址。Docker does not provide packages for all architectures. You can find nightly built binaries in https://master.dockerproject.org. To install docker on a multi-architecture system, add an [arch=...] clause to the entry. Refer to the Debian Multiarch wiki for details.

说明:以前安装docker时,只能安装到1.10,后来打开该文件,发现源不对。更改了以后,后面安装的就是最新的了。

⑤ 更新apt

sudo apt-get update

⑥ 若是有的话,清除老的repo

sudo apt-get purge lxc-docker

⑦ Verify that APT is pulling from the right repository.

apt-cache policy docker-engine

2)安装docker

① 终端中输入:

sudo apt-get update

② 安装docker:

sudo apt-get install docker-engine

③ Start the docker daemon:

sudo service docker start

④ 验证docker成功安装:

sudo docker run hello-world

结果以下:

可选的配置:见参考网址。

 

4. 新版本的docker

新版本docker支持的命令: