简体   繁体   中英

Configuring corp proxy for Docker on Oracle VM VirtualBox

I am looking to build a sample project with docker:

docker build -t helloworld .

But then, I get the following:

>docker build -t helloworld .
Sending build context to Docker daemon  2.048kB
Step 1/2 : FROM java
Get https://registry-1.docker.io/v2/: dial tcp: lookup registry-1.docker.io on 10.0.2.3:53: no such host

I am behind a corporate proxy. I guess I need to configure HTTP/HTTPS proxy from where docker is running and I am trying to setup the environment variable as documented here: docker proxy settings and many other online resources.

However, as I am using Windows 7, I used Docker Toolbox and successfully created a virtual box with this:

docker-machine create -d=virtualbox docker4java

But this creates a VM but without the systemctl . So I am not sure what different setups I need to do when using Oracle VM Virtual box.

Please note: I also followed the advice of changing the nameserver on /etc/resolve.conf file to 8.8.8.8 and this makes no difference only a different error:

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

This worked for me, create .docker directory in your home directory(home directory of user with which docker service is started), inside the .docker directory create config.json file with below configuration. and then restart the docker service.

{
 "proxies":
 {
   "default":
   {
     "httpProxy": "http://myproxy.server.com:8080/",
     "httpsProxy": "http://myproxy.server.com:8080/",
     "noProxy": "my.jenkins.com"
   }
 }
}

Note: my docker version is 18.06.1-ce and API version 1.38

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM