Debian安装docker
1、更新您的软件包索引和已安装软件包:
1 2
| sudo apt-get update sudo apt-get upgrade
|
2、安装所需的软件包以允许apt通过HTTPS使用存储库:
1
| sudo apt-get install apt-transport-https ca-certificates curl gnupg lsb-release
|
3、添加Docker官方GPG密钥:
1
| curl -fsSL https://download.docker.com/linux/debian/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
|
4、指定Docker的APT存储库(根据您的Debian版本选择适当的命令):
For Debian 10 Buster:
1
| echo "deb [arch=amd64 signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/debian buster stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
|
For Debian 11 Bullseye:
1
| echo "deb [arch=amd64 signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/debian bullseye stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
|
5、再次更新软件包索引并安装最新版本的Docker Engine和其他工具:
1 2
| sudo apt-get update sudo apt-get install docker-ce docker-ce-cli containerd.io
|
6、确认Docker已正确安装并正在运行:
1
| sudo systemctl status docker
|
如果Docker正在运行,则输出应类似于以下内容:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
| ● docker.service - Docker Application Container Engine Loaded: loaded (/lib/systemd/system/docker.service; enabled; vendor preset: enabled) Active: active (running) since Mon 2022-03-14 16:44:39 UTC; 17s ago Docs: https://docs.docker.com Main PID: 1758 (dockerd) Tasks: 13 Memory: 96.7M CGroup: /system.slice/docker.service ├─1758 /usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock └─1768 containerd --config /var/run/containerd/containerd.toml --log-level info
Mar 14 16:44:39 debian systemd[1]: Starting Docker Application Container Engine... Mar 14 16:44:39 debian dockerd[1758]: time="2022-03-14T16:44:39.742380950Z" level=info msg="Starting up" Mar 14 16:44:39 debian dockerd[1758]: ...... Mar 14 16:44:39 debian dockerd[1758]: time="2022-03-14T16:44:39.890801274Z" level=info msg="API listen on /var/run/docker.sock" Mar 14 16:44:39 debian systemd[1]: Started Docker Application Container Engine.
|