1. 程式人生 > >如何給docker設定http代理

如何給docker設定http代理

公司網路使用代理伺服器上外網。在ubuntu上用docker pull出現

$sudo docker pull busybox
Using default tag: latest
Pulling repository docker.io/library/busybox
Network timed out while trying to connect to https://index.docker.io/v1/repositories/library/busybox/images. You may want to check your internet connection or if you are behind a proxy.

的錯誤。

但是我明明已經為ubuntu設定了http_proxy了。

查了試了半天,才知道還需要給docker單獨設代理,一下是步驟。

First, create a systemd drop-in directory for the docker service:

mkdir /etc/systemd/system/docker.service.d

Now create a file called /etc/systemd/system/docker.service.d/http-proxy.conf that adds the HTTP_PROXY environment variable:

[Service]
Environment="HTTP_PROXY=http://proxy.example.com:80/"

If you have internal Docker registries that you need to contact without proxying you can specify them via the NO_PROXY environment variable:

Environment="HTTP_PROXY=http://proxy.example.com:80/"
Environment="NO_PROXY=localhost,127.0.0.0/8,docker-registry.somecorporation.com"

Flush changes:

$ sudo systemctl daemon-reload

Verify that the configuration has been loaded:

$ sudo systemctl show docker --property Environment
Environment=HTTP_PROXY=http://proxy.example.com:80/

Restart Docker:

$ sudo systemctl restart docker
現在好使了。

$sudo docker pull busybox
Using default tag: latest
latest: Pulling from library/busybox
8ddc19f16526: Pull complete
Digest: sha256:a59906e33509d14c036c8678d687bd4eec81ed7c4b8ce907b888c607f6a1e0e6
Status: Downloaded newer image for busybox:latest

相關推薦

如何docker設定http代理

公司網路使用代理伺服器上外網。在ubuntu上用docker pull出現 $sudo docker pull busybox Using default tag: latest Pulling repository docker.io/library/busybox Ne

Docker設定HTTP代理docker配置HTTP代理伺服器

參考資料:為docker配置HTTP代理伺服器 一、註釋掉namesserver的配置 [[email protected] ~]# cat /etc/resolv.conf # Generated by NetworkManager search apa.gad.schneider-el

tomcat設定HTTP代理

tomcat有兩種啟動方式,1:直接startup.bat   2:通過service.bat註冊windows服務 方式1設定代理: 在bin目錄裡面找到catalina.bat增加一行http和https代理,自己替換host跟ip set "JAVA_OPTS=-

libcurl設定HTTP代理

curl設定代理基本步驟 設定http代理伺服器:curl_easy_setopt(m_pCurl, CURLOPT_PROXY, "127.0.0.1:8888"); 設定http的代理型別:curl_easy_setopt(m_pCurl, CURLOPT_PROXYT

jmeter設定HTTP代理,錄製APP指令碼

      1.開啟jmeter,“工作臺”右鍵——“新增”——“非測試元件”——“HTTP代理伺服器” 2.設定埠號,手機需與這裡的埠號一致 3.新建執行緒組,“測試計劃”右鍵——“新增”——“Threads(Users)”——“執行緒組” 4.修改執行

GitHub for Windows設定HTTP代理

Github for windows提供了GUI和shell 版本。 公司http需要設定代理才能連github伺服器。但是 GUI版本中沒有設定HTTP代理地方,下面提供兩種方法: 1. 直接修改全域性配置檔案: win7 路徑:C:\Users\Administrat

Android Studio設定HTTP代理地址

Android SDK線上更新映象伺服器 南陽理工學院映象伺服器地址: mirror.nyist.edu.cn 埠:80 中國科學院開源協會映象站地址: IPV4/IPV6: mirrors.opencas.cn 埠:80 IPV4/IPV6: mirrors.o

大陸為Android Studio設定HTTP代理

大陸的牆很厚很高,初次安裝Android Studio下載SDK等必定失敗,設定代理方法如下: 1.  到android studio安裝目錄,開啟bin目錄,編輯idea.properties, 在檔案末尾新增: disable.android.first.run=t

ubuntu關閉apt-get代理設定http代理

ubuntu關閉http代理:今天想裝個軟體(wine),使用 sudo apt-get update 命令時,發現給出很多Ign 語句,總出現 Connecting to proxy.http://10.0.126.1:13128 的字樣,發現這個代理是已經廢棄掉的。接著想

配置DockerHTTP代理

本文是 CHAOS整理而得,在此貼圖,記錄一下docker代理上網的問題,CHAOS的個人部落格:http://www.kalistudy.com/ 場景: 在公司想要上外網,必須走http代理,所以docker安裝完成後,想要去訪問外網,下載image,就必須設定代理

【Android Studio】為Android Studio設定HTTP代理

大陸的牆很厚很高,初次安裝Android Studio下載SDK等必定失敗,設定代理方法如下: 1.  到android studio安裝目錄,開啟bin目錄,編輯idea.properties, 在檔案末尾新增: disable.android.first.run=t

Android Studio設定HTTP代理

下載或更新Android SDK,或者需要線上下載一些使用類似於maven方式共享的jar包,往往需要使用代理翻牆下載。 比如線上下載友盟的統計分析包analytics.jar(com.umeng.analytics:analytics:5.6.1) 1.首先你需要一個

Mac下ShadowSockets全域性設定http代理

Mac下ShadowSockets全域性設定轉http代理,可以更新AndroidSDK,可以終端裡面訪問。  具體操作如下:  前提shadowSockets代理可用,且能完全使用shadowSockets,不會使用的可以百度。  首先安裝polipo,在終端中執行,

如何 NPM 設定代理

GFW 蛋疼的把 https://registry.npmjs.org 給牆了,導致無法通過 NPM 安裝模組。 可以執行如下兩句命令設定代理,注意代理的地址改為自己實際可用的代理。 npm config set proxy=http://127.0.0.1:8087 npm config set

vue-cli專案中的跨域問題,設定訪問代理http/https

找到專案中的config資料夾下的index.js檔案,dev物件內有一個proxyTable的配置項。 dev: { // Paths assetsSubDirectory: "static", assetsPublicPath: "/", proxyT

利用Fiddler手機設定代理

1、在選單欄中找到Tools -> Options,點選進入 2、點選Connections選項,如下圖所示,勾選“Allow remote computers to connect” (若有提示,點選確定即可),然後記住這個預設的8888這個埠(可更改),設定手機代理時會用到,

Docker for Windows 代理設定(linux container)

    Docker 在Pull映象的時候速度很慢,但按照習慣在setting裡面設定proxy為http://127.0.0.1:1080以使用我的代理工具時發現,pull映象時出現Timeout錯誤:    後來找到docker for windows 裡面有切換linu

fiddler自動抓抓包iphone上的http(或https)請求,手機設定http代理,但是手機不能上網了。即(fiddler iphone http代理 不能上網)

fiddler自動抓抓包iphone上的http(或https)請求,手機設定完http代理,但是手機不能上網了。即(fiddler iphone  http代理 不能上網) 在Safari中訪問任何https://baidu.com也不行,說明手機不能上網。

Shell中http代理設定

CMD 基本設定 127.0.0.1 =>代理伺服器的地址(ip,域名,hostname) 1080 => 代理埠號 set http_proxy=http://127.0.0.1:1080 需要使用者名稱和密碼: userna

anaconda設定代理來訪問包來源

公司為了安全,網路連線外網需要設定代理。因此,如果不設定代理,將無法訪問anaconda等python包的來源。代理設定有兩種方法: 1. 先使anaconda允許pip來訪問包管理,然後在pip命令中加入代理的引數。 1. 允許pip訪問包管理:conda config