sudo apt install apt-transport-https ca-certificates curl software-properties-common gnupg lsb-release
# 阿里源(推荐使用阿里的gpg KEY)
curl -fsSL https://mirrors.aliyun.com/docker-ce/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
#阿里apt源
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://mirrors.aliyun.com/docker-ce/linux/ubuntu $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
#更新源
sudo apt update
sudo apt-get update
#安装最新版本的Docker
sudo apt install docker-ce docker-ce-cli containerd.io
#等待安装完成
sudo groupadd docker
sudo usermod -aG docker $USER
sudo systemctl restart docker
sudo chmod o+rw /var/run/docker.sock
newgrp docker
查看所有容器
docker ps -a
sudo gedit ~/.bashrc
groupadd -f docker