1.更新系统包
#apt update
2.安装依赖包
#apt install apt-transport-https ca-certificates curl gnupg lsb-release
3.添加Docker源
(1)添加Docker 官方GPG密钥
#curl -fsSL https://download.docker.com/linux/debian/gpg | gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
(2)添加Docker源
#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
(3)更新软件包缓存
#apt update
4.安装Docker
#apt install docker-ce docker-ce-cli containerd.io
5.设置Docker服务
(1)查看Docker服务运行状态
安装完成后,默认Docker服务是启动的
#systemctl status docker
如果Docker未运行,请执行如下命令启动它。
#systemctl start docker
(2)设置Docker开机自动启动
#systemctl enable docker
6.检查Docker版本信息
#docker version