Nexus repository as a docker registry3 min read

Prabhin Prabharkaran Administrator
DevOps Engineer

He is a Technical professional. He is a person who loves to share tricks and tips on the Internet. He Posts what he does!

follow me

Nexus is a repository manager that helps to collect, proxy, and manage your dependencies in one place. This is a place where you can keep all your artifacts such as libraries, dependencies, etc. To be more clear lets you are developing an application and you have to create a custom Jar module where you want all your developers to use the same for the rest of the module development. If you don’t want other developers to develop the same jar on their own, you publish this kind of dependencies to the nexus repository and make it available for other devs.


By using a nexus repository you can avoid many conflicts like system minor version which impacts the development. Using the nexus repository ensures all developer’s binaries/dependencies are the same across the systems.

In this document, I’m explaining how to use the nexus repository for storing docker images.
You might have heard about the docker registry if not check this link. Docker hub provides public and private docker repositories to store docker images.
When you create a docker image that runs a custom application you want to expose to outside people then always you will prefer to go with docker private repository. If you opt docker hub private repository then you need to pay for the repository on a monthly or yearly basis.
Then next option for you is to set up a self-hosted private registry. Then you have start setup docker private registry.

But if you use a nexus repository manager for storing artifacts you can use the same system for docker repository too. Nexus supports various bundles such as maven, docker, nodejs, etc.

Let’s see how to setup.

Step 1: Log in to the nexus repository manager.
Step 2: Click on the setting button and select the repository. Then create a repository.

Step 3: Here we will create 3 repositories, one is hosted, proxy and another one is a group.

Select docker (hosted)

Provide a Name for repo
Enable online
HTTP: 9001 (you can choose random port)
HTTPS: optional if you https connection for nexus repo
Enable docker v1 API
Blob Store: choose your blob store
Leave the rest with the default option.

the click on Create repository

Step 4: Create a Proxy docker repository.

Provide a Name for repo
Enable online
Lave HTTP and HTTPs connection as empty
URL of proxy storage:https://registry-1.docker.io
and select use docker hub
Enable docker v1 API
Blob Store: choose your blob store
Leave the rest with the default option.

the click on Create repository

Step 5: Create Group docker repository
Provide a Name for repo
Enable online
HTTP: 9001 (you can choose random port)
HTTPS: optional if you https connection for nexus repo
Enable docker v1 API
Blob Store: choose your blob store
add hosted and proxy to the group
Leave the rest with the default option.

Step 6: use this configuration if you use HTTP.

	vi /etc/docker/daemon.json

	{
	  "insecure-registries": [
	    "10.0.0.10:9001",
	    "10.0.0.10:9003"
	  ],
	  "disable-legacy-registry": true
	}

This change because docker always enforces to connect via https. Use nexus repo with https enabled for production.

Do service restart

service docker restart

Step 7: Log in to the nexus docker repository.

docker login 10.0.0.10:9001

enter nexus username and password

you can use either hosted or group port.

Step 8: Let’s push the first image to the registry

docker tag alpine:latest 10.0.0.10:9001/alpine:3.8

docker push 10.0.0.10:9001/alpine:3.8

Step 9: check the nexus repository if the image is available there or not.

Thank you!!

© 2020, Techrunnr. All rights reserved.

#1
#2
#3
Questions Answered
Articles Written
Overall Points

Related posts

Leave a Reply