Unable to use local docker registry

I am trying to configure and use a local docker registry since my application builds images that later need to be pulled by Kubernetes. Originally I was using the built-in registry in microk8s, but I am now trying to just run the registry container and push an image to it, and that does not work. See this minimal example:

dist: focal
- docker
# Run local docker registry.
- docker run -d -p 32000:32000 --restart always --name registry registry:2
- docker tag registry:2 localhost:32000/registry:latest
- docker push localhost:32000/registry:latest

This results in the following:

$ docker push localhost:32000/registry:latest
The push refers to repository [localhost:32000/registry]
Get http://localhost:32000/v2/: EOF
The command "docker push localhost:32000/registry:latest" exited with 1.

Not sure if this needs authentication but here is a link to the build: Travis CI - Test and Deploy with Confidence

Any insights are appreciated. Am I trying to do something unsupported?

My guess is you need to wait for the server in the background container to start up.

Thanks so much for the quick response, after looking at the logs it turned out to be just using the wrong port - 5000 is required. Thanks for pointing me in the right direction!

1 Like