for pkg in docker.io docker-doc docker-compose podman-docker containerd runc; do sudo apt-get remove $pkg; done
apt install -y curl vim wget gnupg dpkg apt-transport-https lsb-release ca-certificates
# 添加Docker的GPG公钥和apt源
#curl -sSL https://download.docker.com/linux/debian/gpg | gpg --dearmor > /usr/share/keyrings/docker-ce.gpg
#echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-ce.gpg] https://download.docker.com/linux/ubuntu $(lsb_release -sc) stable" > /etc/apt/sources.list.d/docker.list
curl -sS https://download.docker.com/linux/debian/gpg | gpg --dearmor > /usr/share/keyrings/docker-ce.gpg
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-ce.gpg] https://mirrors.tuna.tsinghua.edu.cn/docker-ce/linux/ubuntu $(lsb_release -sc) stable" > /etc/apt/sources.list.d/docker.list
apt update
apt install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
docker version
tee /etc/docker/daemon.json << 'EOF'
{
"registry-mirrors": [
"http://hub-mirror.c.163.com",
"https://mirror.baidubce.com",
"https://docker.mirrors.ustc.edu.cn",
"https://registry.docker-cn.com",
"https://dockerproxy.com",
"https://ccr.ccs.tencentyun.com",
"https://registry.cn-hangzhou.aliyuncs.com"
],
"insecure-registries": ["192.168.11.20","192.168.11.30"]
}
EOF
systemctl restart docker.service
docker run hello-world
文章来源地址https://www.toymoban.com/news/detail-606714.html
文章来源:https://www.toymoban.com/news/detail-606714.html
到了这里,关于[Ubuntu 22.04] 安装docker,并设置镜像加速的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!