Ubuntu18.04 安裝 Docker CE 的方法

導讀 這篇文章主要介紹了在Ubuntu18.04上安裝Docker CE的方法(社區版),文中通過示例代碼介紹的非常詳細,對大家的學習或者工作具有一定的參考學習價值,需要的朋友們下面隨着小編來一起學習學習吧。

卸載舊版本

如果之前安裝舊版本,需要先卸載:

$ sudo apt-get remove docker docker-engine docker.io containerd runc

設置倉庫

更新apt包索引:

$ sudo apt-get update

讓apt能通過HTTPS使用倉庫:

$ sudo apt-get install \
  apt-transport-https \
  ca-certificates \
  curl \
  software-properties-common

添加官方的GPG 密鑰:

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

驗證你的密鑰:

$ sudo apt-key fingerprint 0EBFCD88

設置選用哪個版本。

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

我選用了test版本。

安裝

更新apt包索引

$ sudo apt-get update

開始安裝

$ sudo apt-get install docker-ce docker-ce-cli containerd.io

測試

$ sudo docker run hello-world

參考

https://docs.docker.com/engine/install/ubuntu/

以上就是本文的全部內容,希望對大家的學習有所幫助,也希望大家多多支持。

原文來自:https://www.linuxprobe.com/ubuntu-docker-ce.html

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