ubuntu20.04 LTS安裝docker的方法步驟
零:卸載舊版本
Docker 的舊版本被稱為 docker,docker.io 或 docker-engine 。如果已安裝,請(qǐng)卸載它們:
$ sudo apt-get remove docker docker-engine docker.io containerd runc
當(dāng)前稱為 Docker Engine-Community 軟件包 docker-ce 。
一:設(shè)置倉(cāng)庫(kù)
在新主機(jī)上首次安裝 Docker Engine-Community 之前,需要設(shè)置 Docker 倉(cāng)庫(kù)。之后,您可以從倉(cāng)庫(kù)安裝和更新 Docker 。
更新 apt 包索引。
$ sudo apt-get update
安裝 apt 依賴包,用于通過(guò)HTTPS來(lái)獲取倉(cāng)庫(kù):
$ sudo apt-get install \ apt-transport-https \ ca-certificates \ curl \ gnupg-agent \ software-properties-common
添加 Docker 的官方 GPG 密鑰:
$ curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
9DC8 5822 9FC7 DD38 854A E2D8 8D81 803C 0EBF CD88 通過(guò)搜索指紋的后8個(gè)字符,驗(yàn)證您現(xiàn)在是否擁有帶有指紋的密鑰。
$ sudo apt-key fingerprint 0EBFCD88 pub rsa4096 2017-02-22 [SCEA] 9DC8 5822 9FC7 DD38 854A E2D8 8D81 803C 0EBF CD88 uid [ unknown] Docker Release (CE deb) <docker@docker.com> sub rsa4096 2017-02-22 [S]
使用以下指令設(shè)置穩(wěn)定版?zhèn)}庫(kù)
注意:目前 20.04 還沒(méi)有國(guó)內(nèi) docker 源,暫時(shí)用 18.04 版本。
$ sudo add-apt-repository \ "deb [arch=amd64] https://download.docker.com/linux/ubuntu \ bionic \ stable"
二:安裝 Docker Engine-Community
更新 apt 包索引。
$ sudo apt-get update
安裝最新版本的 Docker Engine-Community 和 containerd
$ sudo apt-get install docker-ce docker-ce-cli containerd.io
三:測(cè)試
輸入
$ sudo docker run hello-world
如果docker和你問(wèn)好——或者說(shuō)出現(xiàn)類似以下輸出
Unable to find image 'hello-world:latest' locally latest: Pulling from library/hello-world 1b930d010525: Pull complete Digest: sha256:c3b4ada4687bbaa170745b3e4dd8ac3f194ca95b2d0518b417fb47e5879d9b5f Status: Downloaded newer image for hello-world:latest 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/
就說(shuō)明安裝完事了。
四:免sudo運(yùn)行&鏡像加速
免sudo
參考如下方法將用戶添加到docke組
$ sudo usermod -aG docker [你的用戶名]
重啟docker
$ sudo systemctl restart docker
(然而我的機(jī)器上發(fā)生了很詭異的事——我重啟docker服務(wù)后依然不能以普通用戶啟動(dòng)docker。重啟機(jī)器后才能免sudo運(yùn)行。)
docker鏡像加速
我用了阿里云的免費(fèi)加速
https://cr.console.aliyun.com/cn-hangzhou/instances/mirrors
后續(xù)設(shè)置按照阿里云網(wǎng)頁(yè)內(nèi)提示即可,不再贅述。
五:參考鏈接
-Windows10 安裝 WSL2 Ubuntu20.04 并設(shè)置 docker 環(huán)境
-Ubuntu Docker 安裝
到此這篇關(guān)于ubuntu20.04 LTS安裝docker的方法步驟的文章就介紹到這了,更多相關(guān)ubuntu20.04 LTS安裝docker內(nèi)容請(qǐng)搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持腳本之家!
- ubuntu vps安裝docker報(bào)錯(cuò):Cannot connect to the Docker daemon at unix:///var/run/docker.sock.問(wèn)題解決
- ubuntu14.04+docker的安裝及使用
- 在Ubuntu 16.04安裝與使用Docker的教程詳解
- win10子系統(tǒng)ubuntu(WSL) 安裝Docker的教程(圖文詳解)
- 分享Ubuntu19無(wú)法安裝docker源問(wèn)題
- Windows10安裝WSL2 Ubuntu20.04并設(shè)置docker環(huán)境的方法
- 詳解Ubuntu16.04安裝Docker、nvidia-docker的教程
- Ubuntu Docker 的安裝部署及簡(jiǎn)單應(yīng)用
- Ubuntu?環(huán)境下安裝?Docker環(huán)境詳解
相關(guān)文章
Ubuntu Docker 的安裝部署及簡(jiǎn)單應(yīng)用
這篇文章主要介紹了Ubuntu Docker 的安裝部署的相關(guān)資料,這里說(shuō)明介紹了詳細(xì)的步驟,需要的朋友可以參考下2016-10-10一文搞定Docker安裝ElasticSearch的過(guò)程
通過(guò)本文可以幫助大家快速學(xué)習(xí)Docker安裝ElasticSearch的過(guò)程,本文通過(guò)圖文并茂的形式給大家介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或工作具有一定的參考借鑒價(jià)值,需要的朋友參考下吧2021-08-08Docker 修改docker存儲(chǔ)位置 修改容器鏡像大小限制操作
這篇文章主要介紹了Docker 修改docker存儲(chǔ)位置 修改容器鏡像大小限制操作,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。一起跟隨小編過(guò)來(lái)看看吧2020-11-11CentOS7部署19版docker(簡(jiǎn)單,可跟做)
這篇文章主要介紹了CentOS7部署19版docker,文中通過(guò)示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)學(xué)習(xí)吧2020-01-01Docker-利用dockerfile來(lái)搭建tomcat服務(wù)的方法
這篇文章主要介紹了Docker-利用dockerfile來(lái)搭建tomcat服務(wù)的方法,小編覺(jué)得挺不錯(cuò)的,現(xiàn)在分享給大家,也給大家做個(gè)參考。一起跟隨小編過(guò)來(lái)看看吧2017-01-01阿里云esc服務(wù)器Docker部署單節(jié)點(diǎn)Mysql的講解
今天小編就為大家分享一篇關(guān)于阿里云esc服務(wù)器Docker部署單節(jié)點(diǎn)Mysql的講解,小編覺(jué)得內(nèi)容挺不錯(cuò)的,現(xiàn)在分享給大家,具有很好的參考價(jià)值,需要的朋友一起跟隨小編來(lái)看看吧2019-03-03Mac下部署springBoot項(xiàng)目到Docker中(demo)
本文通過(guò)一個(gè)簡(jiǎn)單的demo給大家分享Mac下部署springBoot項(xiàng)目到Docker的方法,感興趣的朋友一起看看吧2018-01-01Linux/Docker 中使用 System.Drawing.Common 踩坑記錄分享
這篇文章主要介紹了Linux/Docker 中使用 System.Drawing.Common 踩坑記錄,本文通過(guò)兩種方案給大家詳細(xì)介紹,對(duì)大家的學(xué)習(xí)或工作具有一定的參考借鑒價(jià)值,需要的朋友可以參考下2020-07-07Docker?Compose與Docker鏡像倉(cāng)庫(kù)詳解
Docker?Compose可以基于Compose文件幫我們快速的部署分布式應(yīng)用,而無(wú)需手動(dòng)一個(gè)個(gè)創(chuàng)建和運(yùn)行容器,這篇文章主要介紹了Docker?Compose與Docker鏡像倉(cāng)庫(kù),需要的朋友可以參考下2023-03-03