Sonatype Nexus Repository Docker Installation Guide

Sonatype Nexus Repository Installation Using Docker

February 10, 2017
By Rajesh Kumar

2 minute read time

1. Download the Docker image using following commands..

# docker pull sonatype/nexus

2. Build an image from a Nexus Dockerfile

# docker build –rm –tag sonatype/nexus oss/  
# docker build –rm –tag sonatype/nexus-pro pro/ (For Pro)

3. To run (if port 8081 is open on your host):

# docker run -d -p 8081:8081 –name nexus sonatype/nexus:oss  

or to assign a random port that maps to port 8081 on the container:

# docker run -d -p 8081 –name nexus sonatype/nexus

4. To determine the port that the container is listening on:

# docker ps nexus

5. To test:

# curl http://localhost:8081/service/local/status

Notes:

1. Default credentials are: admin / admin123
2. It can take some time (2-3 minutes) for the service to launch in a new container. You can tail the log to determine once Nexus is ready:

# docker logs -f nexus

3. Installation of Nexus is to /opt/sonatype/nexus. Notably: /opt/sonatype/nexus/conf/nexus.properties is the properties file. Parameters (nexus-work and nexus-webapp-context-path) defined here are overridden in the JVM invocation. 4. A persistent directory, /sonatype-work, is used for configuration, logs, and storage. This directory needs to be writable by the Nexus process, which runs as UID 200. 5. Four environment variables can be used to control the JVM arguments

# docker run -d -p 8081:8081 –name nexus -e MAX_HEAP=768m sonatype/nexus

Build faster with Sonatype Nexus Repository

For a more robust solution in managing and storing your components, consider using Sonatype Nexus Repository. Nexus Repository enhances your Docker setup by providing advanced features for component management, security, and scalability.

Reference: Sonatype Nexus Repository on Docker Hub.

Written by Rajesh Kumar
Over 12 years of extensive experience in the Software Configuration Management domain having depth knowledge of DevOps, Continuous Integration and Delivery, Configuration Management, Build and Installer, Release Management and Application Management.