Link to home
Start Free TrialLog in
Avatar of Federico Nardone Aggiutorio
Federico Nardone Aggiutorio

asked on

[Solved] Docker under Proxy doesn't work correctly

Dear users,
I have a big trouble.

My configuration is: Win 10 Pro; Virtual Box 6.0; in Virtual Box, Linux Mint Cinnamon 19.2; and in Linux I have Docker 19.03.5.

From my home connection all works fine and also Docker; I can, i.e., make a "search" without problems. At my work I have a proxy and proxy is well configured (Internet is available and also the browser works fine); for Docker proxy configuration, I have done exactly what is described in this official page https://docs.docker.com/network/proxy/ but Docker doesn't work. If I try a sudo docker search, I see a message:

Error response from daemon: Get https://index.docker.io/v1/search?q=mysql&n=25: dial tcp 52.6.213.218:443: i/o timeout

How can I fix the problem? Is very important, because without Docker I can't work at a foundamental part of the project. Thank you very much, if you need some additional info or logs let me know and I will send you in a minute.

EDIT: This is another response, if I try to run something:

user@User-VirtualBox-Mint:/$ sudo docker run hello-world
[sudo] password for user:        
Unable to find image 'hello-world:latest' locally
docker: Error response from daemon: Get https://registry-1.docker.io/v2/: net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers).
See 'docker run --help'.
Avatar of David Favor
David Favor
Flag of United States of America image

Error... "Error response from daemon: Get https://index.docker.io/v1/search?q=mysql&n=25: dial tcp 52.6.213.218:443: i/o timeout"

Trying to get HTTPS running on a local IP is a very long adventure, as this breaks HTTPS... well... unless you jump through many hoops.

Better to either use HTTP with a local IP or HTTPS with a public IP. Where public IP, in this case, means an IP which has a port 443 instance of Apache listening which can be connected to by any other IP.

So... this doesn't mean a ISP assigned IP for a residence.
Avatar of Federico Nardone Aggiutorio
Federico Nardone Aggiutorio

ASKER

Solution: the solution is in this forum

https://docs.docker.com/config/daemon/systemd/

I created a new folder /etc/systemd/system/docker.service.d and in this folder I created the file http-proxy.config. In this file I wrote the following line. Reload demon, restart docker and all works fine.

[Service]
Environment="HTTP_PROXY=http://127.0.0.1:my_port/"
Environment="HTTPS_PROXY=http://127.0.0.1:my_port/"

Open in new window

Glad you got this solved!
This question needs an answer!
Become an EE member today
7 DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform.
View membership options
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.