[docker] docker: Error response from daemon: Get https://registry-1.docker.io/v2/: Service Unavailable. IN DOCKER , MAC

I am having this issue in my Mac system 10.11.6

system3:postgres saurabh-gupta2$ docker build -t postgres .
Sending build context to Docker daemon  38.91kB
Step 1/51 : FROM registry.access.redhat.com/rhel7/rhel
Get https://registry.access.redhat.com/v2/: Service Unavailable

docker run  -t apline 
Unable to find image 'apline:latest' locally
docker: Error response from daemon: Get https://registry-1.docker.io/v2/: Service Unavailable.
See 'docker run --help'.

I have looked for solution that says to set proxy , but i have set the proxy for the wifi .

https://docs.docker.com/docker-for-mac/networking/#httphttps-proxy-support

Still it is not working .

I have set proxy for docker to . It is not working .

in Preference -> proxies

Docker version 17.12 ce

I also want to know if proxy is issue then , how can i check it is set , what is work around for this ? Is i am in wrong path ?

Edit

Every answer helps , so share how you solve that .

This question is related to docker docker-proxy

The answer is


I tried running on Windows, and got this problem after an update. I tried restarting the docker service as well as my pc, but nothing worked.

When running:

curl https://registry-1.docker.io/v2/ && echo Works

I got back:

{"errors":[{"code":"UNAUTHORIZED","message":"authentication required","detail":null}]}
Works

Eventually, I tried: https://github.com/moby/moby/issues/22635#issuecomment-284956961

By changing the fixed address to 8.8.8.8: enter image description here

Which worked for me! I still got the unauthorized message for curl https://registry-1.docker.io/v2/ but I managed to pull images from docker hub.


The answers are provided here amazing, but if you are new in that and you don't realize full error then you may see at the end of that error net/http: TLS handshake timeout. message means that you have a slow internet connection. So it can be only that problem that's it. Toodles


Here are few suggestions:

  1. Try restarting your Docker service.
  2. Check your network connections. For example by the following shell commands:

    </dev/tcp/registry-1.docker.io/443 && echo Works || echo Problem
    curl https://registry-1.docker.io/v2/ && echo Works || echo Problem
    
  3. Check your proxy settings (e.g. in /etc/default/docker).

If above won't help, this could be a temporary issue with the Docker services (as per Service Unavailable).

Related: GH-842 - 503 Service Unavailable at http://hub.docker.com.

I had this problem for past days, it just worked after that.

You can consider raising the issue at docker/hub-feedback repo, check at, Docker Community Forums, or contact Docker Support directly.


It's clearly a proxy issue: docker proxies https connections to the wrong place. Bear in mind that docker proxy settings may be different from the operating system (and curl) ones. Here's how I managed to solve the issue:

First of all, find out where are you proxying your docker https requests:

# docker info | grep Proxy
Http Proxy: http://<my.proxy.server>:8080
Https Proxy: https://<my.proxy.server>:8080
No Proxy: localhost,127.0.0.1

and double check your https settings.

In my case, I realized that the "Https proxy" was set to https://... instead of http://..., so I corrected it in /etc/sysconfig/docker file (I'm using RHEL7) and, after a docker restart with:

# systemctl restart docker

the proxy variable shows up succesfully updated:

# docker info | grep Proxy
Http Proxy: http://<my.proxy.server>:8080
Https Proxy: http://<my.proxy.server>:8080
No Proxy: localhost,127.0.0.1

and everything works fine :-)


try to reload daemon then restart docker service.

systemctl daemon-reload

One option which worked for me on MAC.

Click on the Docker Icon in the tray. Open Preferences -> Proxies. Click on Manual Proxy and specify Web Server (HTTP) proxy and Secure Web server (HTTPS) proxy in the same format as we specify in HTTPS_PROXY env variable. Choose Apply and Restart.

This Worked for me


I had this issue when I first installed Docker and ran

docker run hello-world

I was on a corporate network and switching to my personal network solved the issue for me.


I had this same issue when working on an Ubuntu server.

I was getting the following error:

deploy@my-comp:~$ docker login -u my-username -p my-password
WARNING! Using --password via the CLI is insecure. Use --password-stdin.
Error response from daemon: Get https://registry-1.docker.io/v2/: dial tcp 35.175.83.85:443: connect: connection refused

Here are the things I tried that did not work:

  • Restarting the docker service using sudo docker systemctl restart docker
  • Powering off and restarting the Ubuntu server.
  • Changing the name server to 8.8.8.8 in the /etc/resolv.conf file

Here's what worked for me:

I tried checking if the server has access to the internet using the following netcat command:

nc -vz google.com 443

And it returned this output:

nc: connect to google.com port 443 (tcp) failed: Connection refused
nc: connect to google.com port 443 (tcp) failed: Network is unreachable

Instead of something like this:

Ncat: Version 7.70 ( https://nmap.org/ncat )
Ncat: Connected to 172.217.166.110:443.
Ncat: 0 bytes sent, 0 bytes received in 0.07 seconds.

I tried checking again if the server has access to the internet using the following wget command:

wget -q --spider http://google.com ; echo $?

And it returned:

4

Instead of:

0

Note: Anything other than 0 in the output means your system is not connected to the internet

I then tried the last time if the server has access to the internet using the following Nmap command:

nmap -p 443 google.com

And it returned:

Starting Nmap 7.01 ( https://nmap.org ) at 2021-02-16 11:50 WAT
Nmap scan report for google.com (216.58.223.238)
Host is up (0.00052s latency).
Other addresses for google.com (not scanned): 2c0f:fb50:4003:802::200e
rDNS record for 216.58.223.238: los02s04-in-f14.1e100.net
PORT    STATE  SERVICE
443/tcp closed https

Nmap done: 1 IP address (1 host up) scanned in 1.21 seconds

Instead something like this:

Starting Nmap 7.01 ( https://nmap.org ) at 2021-02-16 11:50 WAT
Nmap scan report for google.com (216.58.223.238)
Host is up (0.00052s latency).
Other addresses for google.com (not scanned): 2c0f:fb50:4003:802::200e
rDNS record for 216.58.223.238: los02s04-in-f14.1e100.net
PORT    STATE  SERVICE
443/tcp open https

Nmap done: 1 IP address (1 host up) scanned in 1.21 seconds

Note: The state of port 443/tcp is closed instead of open

All this was enough to make me realize that connections to the internet were not allowed on the server.

All I had to do was speak with the team in charge of infrastructure to fix the network connectivity issue to the internet on the server. And once that was fixed my docker command started working fine.

Resources: 9 commands to check if connected to internet with shell script examples

That's all.

I hope this helps


I had the following entries in my /etc/hosts file:

34.228.211.243  registry-1.docker.io
34.205.88.205   auth.docker.io
104.18.121.25   production.cloudflare.docker.com

Just by commenting them out, I fixed the problem.


In my case, stopping Proxifier fixed it. I added a rule to route any connections from vpnkit.exe as Direct and it now works.


Run export DOCKER_CONTENT_TRUST=0 and then try it again.


NTML PROXY AND DOCKER 

If your company is behind MS Proxy Server that using the proprietary NTLM protocol.

You need to install **Cntlm** Authentication Proxy

After this SET the proxy in 
/etc/systemd/system/docker.service.d/http-proxy.conf) with the following format:

[Service]

Environment=“HTTP_PROXY=http://<<IP OF CNTLM Proxy Server>>:3182”

In addition you can set in the .DockerFile
export http_proxy=http://<<IP OF CNTLM Proxy Server>>:3182
export https_proxy=http://<IP OF CNTLM Proxy Server>>:3182
export no_proxy=localhost,127.0.0.1,10.0.2.*

Followed by:
systemctl daemon-reload

systemctl restart docker

This Worked for me


  1. ReCheck Proxy Settings with following commands

    docker info | grep Proxy

  2. Check VPN Connectivity

  3. If VPN not using CHECK NET connectivity

  4. Reinsrtall Docker and repeat above steps.

  5. Enjoy


docker logout
docker login

This might solve your problem


Got this from a network filter (LuLu on macOS) blocking traffic to/from Docker-related processes.


One of the problems you might need to check is, Does the registry requires VPN, Enable your VPN and try pulling again.

Thanks.


I have solved this issue about $ sudo docker run hello-world following the Docker doc.

If you are behind an HTTP Proxy server of corporate, this may solve your problem.

Docker doc also displays other situation about HTTP proxy setting.


For me the problem was solved by restarting the docker daemon:

sudo systemctl restart docker

For me I had this issue when I first installed Docker and ran

docker run hello-world

I got an authentication required error when I ran

curl https://registry-1.docker.io/v2/ && echo Works

All I needed to do was to restart my MacOS and then run the command again, it just started pulling the image and i got the message

Hello from Docker!
This message shows that your installation appears to be working correctly.

Just to add, in case anyone else comes across this issue.

On a Mac I had to logout and log back in.

docker logout

docker login 

Then it prompts for username (NOTE: Not email) and password. (Need an account on https://hub.docker.com to pull images down)

Then it worked for me.