Linux(debian) Docker安装

一、不指定版本安装

apt-get install docker

二、卸载

apt-get remove docker

三、安装指定版本

使用install docker安装的docker版本往往是比较旧的,如需安装最新版本,可以参考docker官方安装教程:https://docs.docker.com/install/linux/docker-ce/debian/#uninstall-old-versions

 

具体步骤如下:

3.1、 安装依赖包,以便apt可以使用https仓库

apt-get install apt-transport-https ca-certificates curl gnupg2 software-properties-common

3.2、 添加docker官方GPG key

curl -fsSL https://download.docker.com/linux/debian/gpg | sudo apt-key add -

 

3.3、 验证GPG key 是否添加成功, 如果列出的.gpg文件中包含0EBFCD88的文件则已成功

apt-key fingerprint 0EBFCD88

//如果列出文件中有包含0EBFCD88的文件则已成功

pub 4096R/0EBFCD88 2017-02-22 Key fingerprint = 9DC8 5822 9FC7 DD38 854A E2D8 8D81 803C 0EBF CD88 

uid Docker Release (CE deb)  

sub 4096R/F273FCD8 2017-02-22

 

3.4、 添加仓库

add-apt-repository \ "deb [arch=amd64] https://download.docker.com/linux/debian \ $(lsb_release -cs) \ stable"

注意:arch=amd64需要根据本机CPU品牌和位数进行选择

X86:32位(一般i386是32位CPU的统称)

X64:64位(代表CPU:IA64,现在几乎没有这样纯粹的64位CPU,都是兼容32位的64位CPU)

X86_64:兼容32位的64位CPU,是64位(Intel的叫法)

AMD64:兼容32位的64位CPU,是64位(AMD的叫法)

 

3.5、更新apt 仓库

apt-get update

 

3.6、 安装最新版本docker

apt-get install docker-ce

 

3.7、安装指定版本docker

(1)查看包含哪些版本 apt-cache madison docker-ce

(2)安装指定版本 apt-get install docker-ce=

如:docker-ce=17.03.0~ce-0~debian-jessie

 

3.8、 验证安装是否成功

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.



To try something more ambitious, you can run an Ubuntu container with:

$ docker run -it ubuntu bash



Share images, automate workflows, and more with a free Docker ID:

https://hub.docker.com/



For more examples and ideas, visit:

https://docs.docker.com/get-started/

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

你可能感兴趣的:(Docker)