Debian 12 安装docker的代码

 

先更新系统和安装需要用的工具

sudo apt update
sudo apt install apt-transport-https ca-certificates curl gnupg
apt-get -y install software-properties-common

 

添加gpg

curl -fsSL https://download.docker.com/linux/debian/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker.gpg
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -

 

按ENTER继续

sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/debian $(lsb_release -cs) stable"

 

添加到源列表

echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker.gpg] https://download.docker.com/linux/debian bookworm stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null

 

更新

sudo apt update

 

安装docker

sudo apt install docker-ce docker-ce-cli containerd.io docker-buildx-plugin
sudo systemctl is-active docker