This tutorial shows you how to install Nexus on your computer with docker.


Distributions for Nexus Repository Manager 3 are available for the 64-bit versions for Apple OSX, Microsoft Windows and Unix/Linux in this link.

In this article I use Docker Hub Image of Nexus on macOS :

Nexus 3 will go up on port 8881. Default credentials are admin/admin123.

Docker Pull Command :

$ docker pull sonatype/nexus3


$ docker run -d -p 8881:8081 --name nexus sonatype/nexus3
# run logs command and wait until the Sonatype Nexus OSS Started
$ docker logs -f nexus


# Default credentials are: admin / admin123
# To test run: 
$ curl -u admin:admin123 http://localhost:8881/service/metrics/ping


Configuring Nexus as a Maven repo

This Image Docker come with  :

  • Private (hosted) repository for our snapshots
  • Private (hosted) repository for our releases
  • Proxy repository pointing to Maven Central

And I Create Group repository

  • Group repository to provide all of these repos under a single URL

Snapshots repo

This repository for Maven artifacts that you deploy with -SNAPSHOT in the end of the version tag of your pom.xml:


Releases repo

A repository for Maven artifact that you deploy without -SNAPSHOT in the end of the version tag of your pom.xml:


Proxy to Maven Central repo

A repository that proxies everything you download from Maven Central. Next time you download the same dependency, it will be cached in your Nexus.

group repo

This will group all the above repos and provide you a single URL to configure your clients to download from/deploy to.

Create a new maven (group) repository and configure it like:

How to interact with Nexus Repository Manager programmatically :

You can get the swagger UI in this URL :  http://localhost:8881/swagger-ui/

For example to get list of all repositories :

$ curl -X GET "http://localhost:8881/service/rest/v1/repositories" -H "accept: application/json"


Configuring your clients and projects to use your Nexus repos

Put this in your ~/.m2/settings.xml file. This will configure the credentials to publish to your hosted repos, and will tell your mvn to use your repo as a mirror of central:

<?xml version="1.0" encoding="UTF-8"?>
<settings xmlns=""




$ cd /Users/rcherara/.m2
$ vi settings.xml


And now configure your projects.

Note : As you see in my last screenshot, I have configured two others repos. Docker Hub and S3 repos,  I will explain with a new article soon how to configure them in new article shortly.

If you want only to download dependencies from Nexus, put this in the pom.xml:

<project ...>



And if you want also to publish your project, add:

<project ...>



Now if you run in your projects:

$ mvn install
# or
$ mvn deploy


your mvn will point to your Nexus instance. and you can see the deployment of  your artifact  on Nexus :