簡體   English   中英

Docker無法使用代理連接到Internet

[英]Docker can't connect to the internet from with proxy

我有這個Linux盒子

$ uname -a
Linux TOCWgfi7IC 2.6.32-504.el6.x86_64 #1 SMP Tue Sep 16 01:56:35 EDT 2014 x86_64 x86_64 x86_64 GNU/Linux

我有docker在上面運行(有人為我安裝了它,但是似乎/ etc / default / docker這樣的配置文件不存在)

我使用代理HTTP和https。
我已經將代理設置添加到.bashrc文件和.bash_profile中,並且能夠使用github進行拉取。 我還添加了HTTP_PROXY和小寫版本(http_proxy)到/etc/default/docker、/etc/environment、/etc/apt/apt.conf、/etc/bash.bashrc以及其他可能的文件中)

我的代理人采用以下格式:

http_proxy=http://proxyprd.sss.com:8080
https_proxy=https://proxyprd.sss.com:8080

如果我使用wget,我什么也收不到。 請求超時。

sudo wget https://index.docker.io/v1
--2015-07-07 13:13:33--  https://index.docker.io/v1
Resolving index.docker.io... 54.174.141.60, 54.210.36.116, 54.152.41.71
Connecting to index.docker.io|54.174.141.60|:443...
failed: Connection timed out.

我查看了docker文檔和一些SO問題,但沒有一個問題為我解決了:
在Ubuntu中將代理與wget一起使用的問題

https://docs.docker.com/articles/systemd/#http-proxy

無法在代理后面下載Docker映像

如何使用docker連接到互聯網。 代理行中是否需要用戶名和密碼?

編輯1
通過添加/root/.wgetrc並將代理放置在其中,wget可以工作。
這不適用於使用/root/.dockerrc的docker :(

這個問題尚未得到解答很長時間,但可能會對其他人有所幫助。

docker build --build-arg http_proxy=http://host:port --build-arg https_proxy=https://host:port -t dwp_service:0.1 dwp_services/

只要在構建映像時將代理作為構建參數傳遞就可以了。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM