Docker设置代理

公司网络走代理上网,虚拟机中Linux拉取镜像失败

拉取失败的信息如下:

Pulling gitlab (gitlab/gitlab-ce:12.1.3-ce.0)...
ERROR: Get https://registry-1.docker.io/v2/: net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers)

通过下面设置就能正常拉取:

## 先停止Docker
systemctl stop docker

## 修改Docker配置文件
vim /lib/systemd/system/docker.service
## 在 [Service] 节点下面新增代理信息
[Service]
......
Environment="HTTP_PROXY=http://10.72.1.253:8080/" "HTTPS_PROXY=http://10.72.1.253:8080/"

## 查询加载Docker并启动 hecg
systemctl daemon-reload
systemctl restart docker
posted @ 2020-01-21 14:39  snower1995  阅读(347)  评论(0编辑  收藏  举报