ubuntu20.04 LTS安裝docker的方法步驟
零:卸載舊版本
Docker 的舊版本被稱為 docker,docker.io 或 docker-engine 。如果已安裝,請卸載它們:
$ sudo apt-get remove docker docker-engine docker.io containerd runc
當(dāng)前稱為 Docker Engine-Community 軟件包 docker-ce 。
一:設(shè)置倉庫
在新主機(jī)上首次安裝 Docker Engine-Community 之前,需要設(shè)置 Docker 倉庫。之后,您可以從倉庫安裝和更新 Docker 。
更新 apt 包索引。
$ sudo apt-get update
安裝 apt 依賴包,用于通過HTTPS來獲取倉庫:
$ 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 通過搜索指紋的后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)}庫
注意:目前 20.04 還沒有國內(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
三:測試
輸入
$ sudo docker run hello-world
如果docker和你問好——或者說出現(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/
就說明安裝完事了。
四:免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)頁內(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)容請搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持腳本之家!
- ubuntu vps安裝docker報(bào)錯(cuò):Cannot connect to the Docker daemon at unix:///var/run/docker.sock.問題解決
- ubuntu14.04+docker的安裝及使用
- 在Ubuntu 16.04安裝與使用Docker的教程詳解
- win10子系統(tǒng)ubuntu(WSL) 安裝Docker的教程(圖文詳解)
- 分享Ubuntu19無法安裝docker源問題
- Windows10安裝WSL2 Ubuntu20.04并設(shè)置docker環(huán)境的方法
- 詳解Ubuntu16.04安裝Docker、nvidia-docker的教程
- Ubuntu Docker 的安裝部署及簡單應(yīng)用
- Ubuntu?環(huán)境下安裝?Docker環(huán)境詳解
相關(guān)文章
Docker鏡像拉取報(bào)錯(cuò):Error response from daemon: 
這篇文章主要介紹了Docker鏡像拉取報(bào)錯(cuò):Error response from daemon: Get https://registry-1.docker.io/v2/的問題解決,本文給大家介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或工作具有一定的參考借鑒價(jià)值,需要的朋友可以參考下2023-07-07
在云服務(wù)器上基于docker安裝jenkins的實(shí)現(xiàn)步驟
本文主要介紹了在云服務(wù)器上基于docker安裝jenkins的實(shí)現(xiàn)步驟,文中通過示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧2022-07-07
使用Docker開發(fā)python Web 應(yīng)用
本文給大家詳細(xì)講解了如何使用Docker開發(fā)python應(yīng)用,特別是WEB應(yīng)用的步驟,Docker本質(zhì)上提供了非常輕量化的VMs,我們可以使用其創(chuàng)建一個(gè)高標(biāo)準(zhǔn)隔離并能大大減少失配的開發(fā)和產(chǎn)品環(huán)境。2016-10-10
Docker部署php運(yùn)行環(huán)境(php-fpm+nginx)
Docker?是一種流行的容器化平臺(tái),可以幫助開發(fā)人員快速創(chuàng)建、部署和管理容器化應(yīng)用程序,本文將介紹如何使用?Docker?搭建?PHP?開發(fā)環(huán)境服務(wù)器,讓您能夠輕松地開始?PHP?開發(fā)工作,感興趣的可以了解一下2023-11-11
Docker創(chuàng)建MongoDB容器并添加root密碼驗(yàn)證與更多用戶詳細(xì)步驟
MongoDB是一個(gè)著名的面向文檔的數(shù)據(jù)庫,被許多現(xiàn)代Web應(yīng)用程序使用,下面這篇文章主要給大家介紹了關(guān)于Docker創(chuàng)建MongoDB容器并添加root密碼驗(yàn)證與更多用戶的相關(guān)資料,需要的朋友可以參考下2023-01-01
Centos7安裝docker compse踩過的坑及解決方法
本文,我們介紹如何在centos7環(huán)境下安裝docker-compose, 記錄下安裝過程步驟以及遇到的問題還有解決辦法,感興趣的朋友參考下吧2018-01-01

