卸载旧版docker

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

设置存储库

1
2
3
4
5
6
7
8
9
10
11
12
13
14
sudo apt-get update

sudo apt-get install \
apt-transport-https \
ca-certificates \
curl \
gnupg \
lsb-release

curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg

echo \
"deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu \
$(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null

安装docker

1
2
sudo apt-get update
sudo apt-get install docker-ce docker-ce-cli containerd.io

更多参考docker官网