Green Moon Software, LLC


Create Your Own Private Docker Registry

This is a post in a series discussing using spring-boot and docker for deployment. Refer to the end of the first post for a table of contents.

Shortly after you start building docker containers you will realize that you need some place to publish your images. You could push to the central docker registry. However, the central registry is public. Not a great idea if you are working on a private project.

If this is your case, you can simply run a local docker registry. To install and run your private registry run $ docker run -p 5000:5000 -d registry

Surprise!!! It is ran in a docker container.

You can now start pushing to your local repository. As an example, I will pull the latest postgres image and push version 9.4 to my local registry.

Outputs:

Looking at the current images, you will notice that the version tagged with localhost and the official images have the same information.

Notice that I had to retag the image with the location of the repository. I thought the requirement to put the location address as part of the image name was a little odd. However, after using docker longer, it makes sense. It ensures you know where the image was originally pulled.

Since docker tags are not permanent, and newer version of the postgres:9.4 image could be pushed to the public registry. When you self-host images, you are in control of when updates are pushed to any base image that you have extended. Someday I intend to learn how to build an image completely from scratch.

Docker-ize All the Things!

comments powered by Disqus