Skip to main content

Sonatype Nexus installation using Docker

Launching a Docker container and configuring access to the Sonatype Nexus web interface.

1. Pull the Nexus Image (optional)​

Download the latest Sonatype Nexus 3 image explicitly:

docker pull sonatype/nexus3

2. Run the Nexus Container​

docker run -d --name nexus -p 8081:8081 -v nexus-data:/nexus-data sonatype/nexus3
  • docker run — Starts a new container.
  • -d — Runs the container in detached mode (in the background).
  • --name nexus — Assigns the name nexus to the container.
  • -p 8081:8081 — Maps port 8081 on the host to port 8081 in the container. This allows you to access Nexus via http://localhost:8081.
  • -v nexus-data:/nexus-data — Creates a Docker volume named nexus-data to persist Nexus data (e.g., repositories, configurations). This ensures that your data is preserved even if the container is stopped or removed.
  • sonatype/nexus3 — Specifies the Docker image to use (Sonatype Nexus 3).

3. Verify the Container is Running​

docker ps

You should see an entry for the nexus container.

4. Access Nexus​

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

http://localhost:8081

This will bring up the Nexus Repository Manager interface.

5. Default Credentials​

When you first access Nexus, you will need to log in. The default admin password is randomly generated and stored in the docker nexus volume nexus-data in the file /nexus-data/admin.password.