這里給出我的安裝配置過程,使用阿里源安裝。
1.卸載舊版本
sudo apt-get remove docker docker-engine docker.io containerd runc
如果存在舊版本,我們需要使用該命令卸載它,不存在也沒有關系,只是會報告沒有安裝這些軟件包。
2.安裝一些必要的系統工具
sudo apt-get update #獲取軟件最新源
sudo apt-get -y install apt-transport-https ca-certificates curl software-properties-common
3.安裝GPG證書
curl -fsSL https://mirrors.aliyun.com/docker-ce/linux/ubuntu/gpg | sudo apt-key add -
4.寫入軟件源信息
sudo add-apt-repository "deb [arch=amd64] https://mirrors.aliyun.com/docker-ce/linux/ubuntu $(lsb_release -cs) stable"
5.更新並安裝docker引擎
sudo apt-get -y update
sudo apt-get -y install docker-ce docker-ce-cli containerd.io
如果需要安裝特定的docker版本,可以參照官網。
6.測試是否安裝成功
sudo docker run hello-world
如上則說明安裝成功。