Setting up Local Nexus Artefact Repository


Step-by-Step Setup

1. Pull the Nexus Docker Image

Open a terminal and run:

docker pull sonatype/nexus3

2. Create a Data Directory

Create a directory on your host machine to persist Nexus data:

mkdir -p ~/nexus-data && chmod -R 777 ~/nexus-data

3. Run Nexus as a Container

Execute the following command to start Nexus:

docker run -d -p 8081:8081 --name nexus \
  -v ~/nexus-data:/nexus-data \
  sonatype/nexus3
  • -d: Runs the container in the background.
  • -p 8081:8081: Maps the web UI to port 8081.
  • -v ~/nexus-data:/nexus-data: Ensures data persistence.

4. Access the Nexus Web Interface

Once the container is running, open a browser and go to:

http://localhost:8081