注:使用过程中,请将"http://192.168.96.159:7890"更换成自己ip和端口号
一、下载docker
- 配置apt代理
sudo gedit /etc/apt/apt.conf.d/proxy.conf
//文件内容
Acquire::https::Proxy "http://192.168.96.159:7890/";
Acquire::http::Proxy "http://192.168.96.159:7890/";
2.(可选,第一第二步选一即可)临时窗口代理(只影响当前终端)
export http_proxy=http://192.168.96.159:7890
export https_proxy=http://192.168.96.159:7890
3.更新包管理器
sudo apt update
- 导入gpg key
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
5.添加apt源(源添加到了'/etc/apt/sources.list.d',不需要了可以删除)
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb\_release -cs) stable"
6.下载docker,docker compose
sudo apt update
sudo apt install docker-ce docker-ce-cli containerd.io docker-compose-plugin
7.包成功的
docker --version
docker compose version
二、docker pull 失败
1.创建docker代理目录
sudo mkdir -p /etc/systemd/system/docker.service.d
2.配置docker代理
sudo gedit /etc/systemd/system/docker.service.d/proxy.conf
//文件内容
[Service]
Environment="HTTP_PROXY=http://192.168.96.159:7890"
Environment="HTTPS_PROXY=http://192.168.96.159:7890"
Environment="NO_PROXY=localhost,127.0.0.1"
3.重启docker
sudo systemctl daemon-reload
sudo systemctl restart docker
4.sudo docker pull包成功的
版权归原作者 m0_62958037 所有, 如有侵权,请联系我们删除。