李光春

Linux:Docker更新到最新版本

· 李光春

查询当前版本

docker version --format '{{.Server.Version}}'

更新系统包

apt update
apt upgrade

添加Docker官方存储库,需要提前安装 gpg

curl -fsSL https://download.docker.com/linux/debian/gpg | gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
echo "deb [arch=amd64 signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/debian $(lsb_release -cs) stable" | tee /etc/apt/sources.list.d/docker.list > /dev/null

更新软件包索引并安装Docker https://docs.docker.com/engine/release-notes/26.0/

apt update
apt upgrade
apt install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin

验证安装

docker --version