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) <[email protected]> 

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=<VERSION_STRING>

如: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/

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章