一毛好、安裝與啟動(dòng)
備份source.list劫窒,更新鏡像鏈接
sudo cp /etc/apt/sources.list /etc/apt/sources.list.bak
vim?/etc/apt/sources.list
輸入99dd刪除所有辕坝,輸入i插入波岛,插入一下鏈接
deb http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse
保存后,更新
sudo apt-get update
添加使用 https 傳輸?shù)能浖?CA證書
sudo apt-get install apt-transport-https ca-certificates curl gnupg-agent software-properties-common
添加軟件源的 GPG 密鑰
curl -fsSL https://mirrors.aliyun.com/docker-ce/linux/ubuntu/gpg | sudo apt-key add -
添加 docker 軟件源
sudo add-apt-repository "deb [arch=amd64] https://mirrors.aliyun.com/docker-ce/linux/ubuntu?$(lsb_release -cs)? stable"
sudo apt-get update
安裝 Docker CE
sudo apt-cache madison docker-ce
sudo apt-get install docker-ce docker-ce-cli containerd.io
啟動(dòng)
sudo service docker start
二险耀、遇到問題
在Ubuntu中弄喘,很多小伙伴會遇到docker啟動(dòng)了但是使用service docker status 查看狀態(tài)時(shí)都顯示“Docker is not running”,這時(shí)甩牺,首先要檢查一下在windows下是否將Ubuntu 的版本設(shè)置成2蘑志,如圖
查看命令? wsl -l -v
設(shè)置命令 wsl --set-version Ubuntu-18.04 2