一振湾、卸載舊版本
sudo apt-get remove docker docker-engine docker.io containerd runc
二杀迹、使用存儲(chǔ)庫安裝
1、安裝依賴工具
sudo apt-get update
sudo apt-get install \
ca-certificates \
curl \
gnupg \
lsb-release
2押搪、添加docker官方GPG key
sudo mkdir -p /etc/apt/keyrings
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg
3树酪、配置軟件包源
echo \
"deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu \
$(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
4、安裝Docker Engine
sudo apt-get update
sudo apt-get install docker-ce docker-ce-cli containerd.io docker-compose-plugin
三大州、配置阿里云容器鏡像
sudo mkdir -p /etc/docker
sudo tee /etc/docker/daemon.json <<-'EOF'
{
"registry-mirrors":["https://xxxxxxxx.mirror.aliyuncs.com"]
}
EOF
sudo systemctl daemon-reload
sudo systemctl restart docker
使用您的阿里云容器鏡像加速器地址替換
四续语、非root用戶身份管理Docker
1、創(chuàng)建用戶組
sudo groupadd docker
2厦画、添加當(dāng)前用戶到docker用戶組
sudo usermod -aG docker $USER
3疮茄、注銷登錄或者重啟使更改生效;或執(zhí)行下面的命令在當(dāng)前會(huì)話立即生效
newgrp docker
阿里云容器鏡像服務(wù): https://cr.console.aliyun.com/cn-hangzhou/instances/mirror
docker官方文檔: https://docs.docker.com/engine/install/ubuntu/