2025-04-01
在 ubuntu-24.04.1
上安装 docker
参考自 https://www.sysgeek.cn/install-docker-ubuntu/
| sudo apt update |
| sudo apt install apt-transport-https curl |
这一步遇到问题,可能失败,失败后会在 /etc/apt/keyrings/docker.gpg 写一个空文件,需要删除后重试
| curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg |
虽然格式和apt自带的不一致,但是能用
| echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu $(. /etc/os-release && echo "$VERSION_CODENAME") stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null |
这一步下载很慢,选择给apt设置代理(http_proxy环境变量居然无效) 创建文件 /etc/apt/apt.conf.d/proxy.conf
并写入
| Acquire::http::Proxy "http://192.168.1.1:7890/"; |
| Acquire::https::Proxy "http://192.168.1.1:7890/"; |
| |
| sudo apt install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin |
| sudo systemctl is-active docker |
下不动哈哈哈
在 https://cloud.tencent.com/developer/article/2485043 找到了可用的两个镜像源
编辑文件 /etc/docker/daemon.json
| { |
| "registry-mirrors": [ |
| "https://docker.xuanyuan.me", |
| "https://docker.1ms.run" |
| ] |
| } |
配置完成后
| sudo systemctl daemon-reload |
| sudo systemctl restart docker |