Getting connection refused in docker

6,309

I got the solution for this.

1.Create a systemd drop-in directory for the docker service:

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

2.Create a file called /etc/systemd/system/docker.service.d/http-proxy.conf that adds the HTTP_PROXY environment variable: (Use sudo touch/nano to create file)

sudo nano filename.txt

[Service]

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

3.Flush changes:

$ sudo systemctl daemon-reload

4.Restart Docker:

$ sudo systemctl restart docker

5.Verify that the configuration has been loaded:

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

visit : https://docs.docker.com/config/daemon/systemd/#httphttps-proxy

Share:
6,309

Related videos on Youtube

R Kumar
Author by

R Kumar

Updated on September 18, 2022

Comments

  • R Kumar
    R Kumar over 1 year

    I am using ubuntu 16.04. After installing docker, when I run docker pull hello-world, I am getting this error :

    Using default tag: latest
    Error response from daemon: Get https://registry-1.docker.io/v2/: dial tcp 35.169.231.249:443: getsockopt: connection refused
    

    I think the problem may be due to the proxy setting of my connection. I am using college LAN and it uses proxy setting for hostname and port. I am getting problem only here in docker. Rest of the thing is working properly in connectivity. Please help, what to do?