在Debian系统上安装Docker,可以按照以下步骤操作:
1、更新软件包索引:
apt update -y
2、安装必要的软件包以允许apt通过HTTPS使用仓库:
apt install -y apt-transport-https ca-certificates curl gnupg2 software-properties-common
3、添加Docker的官方GPG密钥:
curl -fsSL https://download.docker.com/linux/debian/gpg | apt-key add -
4、设置Docker的稳定仓库:
add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/debian $(lsb_release -cs) stable"
5、再次更新软件包索引:
apt update -y
6、安装Docker CE(社区版):
apt install -y docker-ce docker-ce-cli containerd.io
7、验证Docker是否安装成功并运行:
systemctl status docker
或者,可以简单地运行一个测试镜像:
docker run hello-world
阿里源一键安装
```
curl -fsSL https://get.docker.com | bash -s docker --mirror Aliyun
```