Setting up a Local Docker Container Registry

Kim Wuestkamp
1 min readMar 20, 2019

--

As we are in the process of setting up our local development environment using Kubernetes, we would also want to build and push/pull our images without relying on external services like GCR (Google Container Registry) etc.

Setup Registry

Well, this is quite easy. We just use the existing registry package for this:

docker run -d -p 5000:5000 --name registry registry:latest

Push / Pull

Now we can simply pull and push into this repository:

docker image tag my-image localhost:5000/my-imagedocker push localhost:5000/my-image
docker pull ...

View Images

To display available images we can simply run:

$ curl -X GET http://localhost:5000/v2/_catalog
{"repositories":["my-image"]}

Here you can check the repository API ref.

Start Registry Again

After reboot (or just docker boot) we can run our registry again with:

docker start registry

Another solution would be to use the --restart=always parameter:

docker run -d -p 5000:5000 --name registry --restart=always registry:latest

Remove Registry

docker container stop registry && docker container rm -v registry

For more detailed information, maybe to even use your own registry in production, visit https://docs.docker.com/registry/deploying/

--

--

Kim Wuestkamp

killercoda.com | killer.sh (CKS CKA CKAD Simulator) | Software Engineer, Infrastructure Architect, Certified Kubernetes