debian11安装docker

No.1 安装依赖
1
sudo apt install apt-transport-https lsb-release ca-certificates curl gnupg -y
No.2 下载并添加 Docker GPG 密钥
1
2
curl -fsSL https://download.docker.com/linux/debian/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/debian $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
No.3 更新
1
sudo apt update
No.4 安装 Docker
1
sudo apt -y install docker-ce docker-ce-cli containerd.io

验证版本

1
sudo docker version

开机自启动docker

1
sudo systemctl enable docker

检查Docker服务状态

1
sudo systemctl status docker