码迷,mamicode.com
首页 > 其他好文 > 详细

docker proxy

时间:2020-02-15 15:23:51      阅读:96      评论:0      收藏:0      [点我收藏+]

标签:strong   参考   result   class   lis   检查   trick   boot   mes   

 

参考:https://forums.docker.com/t/docker-pull-results-in-request-canceled-while-waiting-for-connection-client-timeout-exceeded-while-awaiting-headers/73064/7

Previous solution only worked until I reboot my machine. Sigh.

But I’ve found another trick in my linux.

I did force the daemon to run through a proxy before connecting the the docker servers, as the registry-1.docker.io was giving me timeout error and I could not even ping it anymore.

Following this instructions 87 I could fix my problem. And that’s all I did:

1. Create a new directory:

$ sudo mkdir -p /etc/systemd/system/docker.service.d

2. Get a free http proxy from this list 195.

3. Create the file below and paste the http proxy server

# File: /etc/systemd/docker.service.d/http-proxy.conf
[Service]
Environment="HTTP_PROXY=208.123.76.34:8080"
Environment="NO_PROXY=localhost,127.0.0.1"

4. Reload systemd manager configurations:

sudo systemd daemon-reload

5. Restart the Docker’s daemon service:

sudo systemd restart docker

6. Check if it’s working:

docker pull alpine

Now it is working here, but the download speed is slow as it is not connected directly to the server. I googled a lot and I’ve no clue how to fix this another way.

.
Edit: Don’t use a proxy to log in as the connection goes through someone’s pc, they will receive your credentials. Today I removed the http proxy to login, and sometimes the connection is stablished, sometimes it isn’t. My network is slow since the past week. Perhaps that’s the reason?

 

之前的解决方案只能在重新启动计算机之前起作用。叹。

但是我在我的电脑中找到了另外一个窍门linux

我确实强迫守护程序在连接Docker服务器之前通过代理运行,因为这registry-1.docker.io给了我超时错误,我什至无法对其进行ping操作。

按照此说明87, 我可以解决我的问题。这就是我所做的一切:

1.创建一个新目录:

$ sudo mkdir -p /etc/systemd/system/docker.service.d

2.从此列表195 获得免费的http代理

3.在下面创建文件并粘贴http代理服务器

# File: /etc/systemd/docker.service.d/http-proxy.conf
[Service]
Environment="HTTP_PROXY=208.123.76.34:8080"
Environment="NO_PROXY=localhost,127.0.0.1"

4.重新加载systemd Manager配置:

sudo systemd daemon-reload

5.重新启动Docker的守护程序服务:

sudo systemd restart docker

6.检查它是否正常工作:

docker pull alpine

现在它可以在这里工作,但是下载速度很慢,因为它没有直接连接到服务器。我在Google上搜索了很多,但不知道如何以其他方式解决这个问题。


Edit:当连接通过某人的PC时,请勿使用代理进行登录,否则他们会收到您的凭据。今天,我删除了HTTP代理进行登录,有时建立了连接,有时没有建立连接。自上周以来,我的网络运行缓慢。也许那是原因吗?

docker proxy

标签:strong   参考   result   class   lis   检查   trick   boot   mes   

原文地址:https://www.cnblogs.com/BillyLV/p/12311885.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!