Debian 安装 Docker。
这是官方安装文档
这是我的安装步骤相关命令记录。
bash
# 卸载旧版本
apt-get remove docker docker-engine docker.io containerd runc
# 配置资源
apt-get update
apt-get install -y ca-certificates curl gnupg lsb-release
mkdir -m 0755 -p /etc/apt/keyrings
curl -fsSL https://download.docker.com/linux/debian/gpg | gpg --dearmor -o /etc/apt/keyrings/docker.gpg
echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/debian $(lsb_release -cs) stable" | tee /etc/apt/sources.list.d/docker.list > /dev/null
chmod a+r /etc/apt/keyrings/docker.gpg
apt-get update
# 安装DockerEngine最新版
apt-get install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
docker info
# 设置镜像仓库
mkdir -p /etc/docker
tee /etc/docker/daemon.json <<-'EOF'
{
"registry-mirrors": ["https://62oh6osg.mirror.aliyuncs.com"],
"log-driver":"json-file",
"log-opts":{ "max-size":"50m" }
}
EOF
systemctl daemon-reload
systemctl restart docker
# 开机启动
systemctl enable docker
注意:确保docker官方源安装成功再继续,不然安装的版本会比较旧。