最近参照网上教程安装ubuntu的Docker怎么都不成功,我最后参照官方文档成功安装
https://docs.docker.com/engine/installation/linux/docker-ce/ubuntu/#if-you-need-to-use-aufs
大家可以先不笔管具体的细节,我把需要粘贴的代码放到下面。大家一步步安装就好,如果遇到问题可以留言。
我是用的镜像就是官网直接下载的16.04镜像
首先删除旧版本
$ sudo apt-get remove docker docker-engine docker.io
安装store driver aufs
驱动
$ sudo apt-get update $ sudo apt-get install linux-image-extra-$(uname -r) linux-image-extra-virtual
设定数据仓库
设置apt可以通过HTTPS方式访问
$ sudo apt-get update
$ sudo apt-get install
apt-transport-https
ca-certificates
curl
software-properties-common
添加官方GPG key:
$ curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
验证你已经添加成功,第一行是代码,后面是结果
$ sudo apt-key fingerprint 0EBFCD88 pub 4096R/0EBFCD88 2017-02-22 Key fingerprint = 9DC8 5822 9FC7 DD38 854A E2D8 8D81 803C 0EBF CD88 uid Docker Release (CE deb) <docker@docker.com> sub 4096R/F273FCD8 2017-02-22
设定稳定版本的数据仓库
$ sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" $ sudo add-apt-repository "deb [arch=armhf] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" $ sudo add-apt-repository "deb [arch=s390x] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
安装Docker CE
$ sudo apt-get update
$ sudo apt-get install docker-ce
验证是否安装成功,和centos不同不需要启动服务
$ sudo docker run hello-world
输出如下则表示安装成功
Hello 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. (amd64) 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.
以上过程傻瓜式的照搬就可以,时间是2017年12月7日,所以如果大家采用了和我一个版本的unbutn镜像文件,应该是可以安装成功的