skip to Main Content

Im using centos 7.7 and docker 19.03.

I cannot pull images and getting :

Error response from daemon: Get https://registry-1.docker.io.v2./: dial tcp lookup : server misbehaving

I did what all guides on google suggested:

cat /etc/systemd/system/docker.service.d/http-proxy.conf
[Service]
Enviroment="HTTP_PROXY=http://myproxy"

systemctl deamon reload
systemctl restart docker

and nothing happends.
if i do echo $http_proxy i see my settings.

more settings:
/etc/enviroment

http_proxy=http://myproxy
https_proxy=https://myproxy

The proxy setting used to work and is working on another server.
On this server i had deleted docker old versions :

docker-1.13.1
docker-common-1.13.1
docker-client-1.13.1

With the older docker it seems to work but with docker-ce it doesnt.
I even rebooted and reinstalled again.

3

Answers


  1. Chosen as BEST ANSWER

    Solved it! I guess because i am using Centos then doing systemctl restart docker didnt really work.

    Created the directory :

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

    Create the file :

    nano /etc/systemd/system/docker.service.d/http-proxy.conf
    

    Add the following line:

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

    Restart daemon:

    systemctl daemon-reload
    

    And this restart method worked:

    service docker restart
    

    and then it accepted all the env vars


  2. Set both variables, and they can both be set to your http server. The variable is for the type of traffic being proxied, not the protocol to the proxy server:

    [Service]
    Enviroment="HTTP_PROXY=http://myproxy"
    Enviroment="HTTPS_PROXY=http://myproxy"
    
    Login or Signup to reply.
  3. The latest documentation detailing the configuration of Docker to use Proxy server worked for me to build my latest docker image.

    • For latest docker clients (>= v17.07) create or edit the file ~/.docker/config.json

    • For older docker clients (<= v17.06) use the –env flag to set the proxy accordingly

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search