Installing a Docker registry

As we discussed in the previous post

a registry is a stateless, highly scalable server side application that stores and lets you distribute Docker images. - https://docs.docker.com/registry/

In this post we will explain how to install our "on premises Docker registry".

I will use a Nexus 3 repository, as it knows how to host Docker images now (nuget, npm too...), and as this seems an easier path to our existing infrastructure.

(Alternatively, you can also follow the instructions here from Docker to install their official registry. https://docs.docker.com/registry/)

Have a look first at the installed registry here:
http://jmkhael.io:8081/#browse/browse/components:docker-internal

(The essence of this post is also documented on mxwiki)

To get that, you need to run in a shell:

docker pull sonatype/nexus3
mkdir -p /data/nexus/nexus-data && chown -R 200 /data/nexus
docker run -d -p 8081:8081 -p 18078:18078 -p 18079:18079 --name nexus -v /data/nexus/nexus-data:/nexus-data sonatype/nexus3

Then, open up a browser to your host:port, in my example, host:port is http://jmkhael.io:8081

  1. login using the default Nexus credentials (admin/admin123)
  2. head on to host:port/#admin/repository/repositories
  3. create a new repository as per the below image for instance

docker-regsitry-config

That's it!

In the next post, we will build an image and push it to our registry.