Jordi
Jordi

Reputation: 23277

Docker registry: unable to push image since dns_unresolved_hostname

I'm not able to push an image to my local registry

$ docker image push registry.local:5000/covid-backend:60988b0-dirty
The push refers to repository [registry.local:5000/covid-backend]
eff147c1024b: Preparing 
790a9d8e41bb: Preparing 
20dd87a4c2ab: Preparing 
78075328e0da: Preparing 
9f8566ee5135: Preparing 
error parsing HTTP 404 response body: invalid character '<' looking for beginning of value: "<HTML><HEAD>\r\n<TITLE>Network Error</TITLE>\r\n</HEAD>\r\n<BODY>\r\n<FONT face=\"Helvetica\">\r\n<big><strong></strong></big><BR>\r\n</FONT>\r\n<blockquote>\r\n<TABLE border=0 cellPadding=1 width=\"80% \">\r\n<TR><TD>\r\n<FONT face=\"Helvetica\">\r\n<big>Network Error (dns_unresolved_hostname)</big>\r\n<BR>\r\n<BR>\r\n</FONT>\r\n</TD></TR>\r\n<TR><TD>\r\n<FONT face=\"Helvetica\">\r\nYour requested host \"registry.local\" could not be resolved by DNS.\r\n</FONT>\r\n</TD></TR>\r\n<TR><TD>\r\n<FONT face=\"Helvetica\">\r\n\r\n</FONT>\r\n</TD></TR>\r\n<TR><TD>\r\n<FONT face=\"Helvetica\" SIZE=2>\r\n<BR>\r\nFor assistance, contact your network support team.\r\n</FONT>\r\n</TD></TR>\r\n</TABLE>\r\n</blockquote>\r\n</FONT>\r\n</BODY></HTML>\r\n"

HTML content response contains:

Network Error (dns_unresolved_hostname) Your requested host \\"registry.local\\" could not be resolved by DNS.

I've tried to reach it using curl:

$ curl -s registry.local:5000/v2/_catalog
{"repositories":["covid-backend","skaffold-covid-backend"]}

My /etc/hosts:

127.0.0.1   localhost registry.local

I've also tried to add it into my ~/.docker/config.json as insecure registry:

"insecure-registries" : [
    "registry.local:5000"
]

I've also took a look on docker logs:

abr 27 09:30:25 psgd dockerd[15476]: time="2020-04-27T09:30:25.967945384+02:00" level=info msg="Attempting next endpoint for push after error: Get https://registry.local:5000/v2/: Service Unavailable"
abr 27 09:30:29 psgd dockerd[15476]: time="2020-04-27T09:30:29.121878880+02:00" level=error msg="Upload failed: error parsing HTTP 404 response body: invalid character '<' looking for beginning of value: \"<HTML><HEAD>\\r\\n<TITLE>Network Error</TITLE>\\r\\n</HEAD>\\r\\n<BODY>\\r\\n<FONT face=\\\"Helvetica\\\">\\r\\n<big><strong></strong></big><BR>\\r\\n</FONT>\\r\\n<blockquote>\\r\\n<TABLE border=0 cellPadding=1 width=\\\"80% \\\">\\r\\n<TR><TD>\\r\\n<FONT face=\\\"Helvetica\\\">\\r\\n<big>Network Error (dns_unresolved_hostname)</big>\\r\\n<BR>\\r\\n<BR>\\r\\n</FONT>\\r\\n</TD></TR>\\r\\n<TR><TD>\\r\\n<FONT face=\\\"Helvetica\\\">\\r\\nYour requested host \\\"registry.local\\\" could not be resolved by DNS.\\r\\n</FONT>\\r\\n</TD></TR>\\r\\n<TR><TD>\\r\\n<FONT face=\\\"Helvetica\\\">\\r\\n\\r\\n</FONT>\\r\\n</TD></TR>\\r\\n<TR><TD>\\r\\n<FONT face=\\\"Helvetica\\\" SIZE=2>\\r\\n<BR>\\r\\nFor assistance, contact your network support team.\\r\\n</FONT>\\r\\n</TD></TR>\\r\\n</TABLE>\\r\\n</blockquote>\\r\\n</FONT>\\r\\n</BODY></HTML>\\r\\n\""
abr 27 09:30:29 psgd dockerd[15476]: time="2020-04-27T09:30:29.122824956+02:00" level=info msg="Attempting next endpoint for push after error: error parsing HTTP 404 response body: invalid character '<' looking for beginning of value: \"<HTML><HEAD>\\r\\n<TITLE>Network Error</TITLE>\\r\\n</HEAD>\\r\\n<BODY>\\r\\n<FONT face=\\\"Helvetica\\\">\\r\\n<big><strong></strong></big><BR>\\r\\n</FONT>\\r\\n<blockquote>\\r\\n<TABLE border=0 cellPadding=1 width=\\\"80% \\\">\\r\\n<TR><TD>\\r\\n<FONT face=\\\"Helvetica\\\">\\r\\n<big>Network Error (dns_unresolved_hostname)</big>\\r\\n<BR>\\r\\n<BR>\\r\\n</FONT>\\r\\n</TD></TR>\\r\\n<TR><TD>\\r\\n<FONT face=\\\"Helvetica\\\">\\r\\nYour requested host \\\"registry.local\\\" could not be resolved by DNS.\\r\\n</FONT>\\r\\n</TD></TR>\\r\\n<TR><TD>\\r\\n<FONT face=\\\"Helvetica\\\">\\r\\n\\r\\n</FONT>\\r\\n</TD></TR>\\r\\n<TR><TD>\\r\\n<FONT face=\\\"Helvetica\\\" SIZE=2>\\r\\n<BR>\\r\\nFor assistance, contact your network support team.\\r\\n</FONT>\\r\\n</TD></TR>\\r\\n</TABLE>\\r\\n</blockquote>\\r\\n</FONT>\\r\\n</BODY></HTML>\\r\\n\""

My NO_PROXY environment variable content:

$ echo $NO_PROXY
localhost,127.0.0.1/8,::1,192.168.99.0/8,registry.local

Upvotes: 0

Views: 655

Answers (1)

Jordi
Jordi

Reputation: 23277

The problem is that I need to configure correctly docker behind proxy.

I though proxy-related environment variables is enough (HTTP_PROXY, HTTPS_PROXY and NO_PROXY).

You can find how to configure docker behind a proxy here.

I've just added NO_PROXY on /etc/systemd/system/docker.service.d/ files like:

[Service]
Environment="HTTP_PROXY=http://<proxy-ip>:<proxy-port>/" "NO_PROXY=localhost, 127.0.0.1/8, ::1, 192.168.99.0/8, registry.local"

Solved.

Upvotes: 1

Related Questions