Unable to push Docker images to local registry, client times out

12/1/2021

I'm writing as I've encountered an issue that doesn't seem to get resolved, would value the community's help.

I'm trying to push an image to a local registry I deployed on port 5000.

When I use this command docker push localhost:5000/explorecalifornia.com to push the image to my local registry, I get the following message

Get "http://localhost:5000/v2/": net/http: request canceled (Client.Timeout exceeded while awaiting headers)

I've confirmed the registry is on port 5000 by using GET on postman, and I get a valid, expected {} response (since there's no images currently on my local registry).

I've since tried to fix this by updating my etc/hosts file to comment out "::1 localhost" per advise of this post. This is the contents of my etc/hosts file

##
# Host Database
#
# localhost is used to configure the loopback interface
# when the system is booting.  Do not change this entry.
##
127.0.0.1	localhost
255.255.255.255	broadcasthost
# ::1 localhost
# Added by Docker Desktop
# To allow the same kube context to work on the host and the container:
127.0.0.1 kubernetes.docker.internal
# End of section

I also updated my etc/resolve.conf file with the following nameservers per advise from this post.

nameserver 10.0.2.3
nameserver 8.8.8.8
nameserver 8.8.4.4

None of this worked. Did anyone also encounter this issue? Is there any recommendations to help fix this issue?

Here's the source code if it helps! Thank you in advance :)

-- keshinpoint
docker
kind
kubernetes
macos
networking

3 Answers

12/1/2021

You may have a HTTP proxy defined. Please try running these commands.

unset http_proxy
unset https_proxy
-- Rakesh Gupta
Source: StackOverflow

12/13/2021

I think there must be sth changed with the kind image. I use the script from this page: https://kind.sigs.k8s.io/docs/user/local-registry/

I am able to create a new kind cluster and registry. After that, I have no problem following the video lecture to push the explorecalifornia.com image to the local registry.

-- Andy Leung
Source: StackOverflow

1/5/2022

I use a work-around for this error and it is as below:

Firstly, tag the images using the localhost ip instead, ie

docker tag imagename 127.0.0.1:5000/imagename

and,

docker push 127.0.0.1:5000/imagename

I hope this works for you as well.

-- sonierk88
Source: StackOverflow