服務器
這篇文章主要講解了ubuntu20.04 lts如何安裝docker,內容清晰明了,對此有興趣的小伙伴可以學習一下,相信大家閱讀完之后會有幫助。
零:卸載舊版本
docker 的舊版本被稱為 docker,docker.io 或 docker-engine 。如果已安裝,請卸載它們:
$ sudo apt-get remove docker docker-engine docker.io containerd runc當前稱為 docker engine-community 軟件包 docker-ce 。
一:設置倉庫
在新主機上首次安裝 docker engine-community 之前,需要設置 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個字符,驗證您現在是否擁有帶有指紋的密鑰。
$ sudo apt-key fingerprint 0ebfcd88 pub rsa4096 2017-02-22 [scea] 9dc8 5822 9fc7 dd38 854a e2d8 8d81 803c 0ebf cd88uid [ unknown] docker release (ce deb) <docker@docker.com>sub rsa4096 2017-02-22 [s]使用以下指令設置穩定版倉庫
注意:目前 20.04 還沒有國內 docker 源,暫時用 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和你問好——或者說出現類似以下輸出
unable to find image 'hello-world:latest' locallylatest: pulling from library/hello-world1b930d010525: pull complete digest: sha256:c3b4ada4687bbaa170745b3e4dd8ac3f194ca95b2d0518b417fb47e5879d9b5fstatus: downloaded newer image for hello-world:latesthello 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 bashshare 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運行&鏡像加速
免sudo
參考如下方法將用戶添加到docke組
$ sudo usermod -ag docker [你的用戶名]重啟docker
$ sudo systemctl restart docker看完上述內容,是不是對ubuntu20.04 lts如何安裝docker有進一步的了解,如果還想學習更多內容,歡迎關注資訊頻道。
com域名多少天刪除?一定要進行實名認證嗎?根服務器為什么只能有13個阿里云從哪里買服務器阿里云服務器快速備案流程遠程無法鏈接-云服務器問題美團旗下生鮮超市“小象生鮮”落地無錫云服務器怎么能多開有教程沒【池州seo】網站seo優化中常會遇到的問題