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.
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