Skip to content
This repository was archived by the owner on Mar 14, 2023. It is now read-only.

Dockerized Sonatype Nexus Repository Manager OSS ready to use as Proxy for most common Repositories.

License

Notifications You must be signed in to change notification settings

codeclou/docker-sonatype-nexus-repository-oss

Repository files navigation

📣 End of Lifetime Notice: We no longer provide support for this repository. It will be made readonly, you can still fork it and adapt it to your needs.


docker-sonatype-nexus-repository-oss

Dockerized Sonatype Nexus Repository Manager OSS ready to use as Proxy for most common Repositories.


 

Prerequisites


 

Initial Configuration

(1) Add hostname alias

Add the alias on your Docker-Host machine. Or configure a valid hostname in your DNS.

sudo su
echo "127.0.0.1  nexus.home.codeclou.io" >> /etc/hosts

(2) Prepare the shared volume directory

sudo su
mkdir /opt/nexus-oss-home
chown 10777:10777 /opt/nexus-oss-home

(3) Generate a self signed SSL Certificate for Nexus

NEXUS_DOMAIN="nexus.home.codeclou.io"
NEXUS_IP_ADDRESS="192.168.178.66"

keytool -genkeypair -keystore keystore.jks \
        -storepass password \
        -keypass password \
        -alias jetty \
        -keyalg RSA \
        -keysize 2048 \
        -validity 5000 \
        -dname "CN=${NEXUS_DOMAIN}, OU=Example, O=Sonatype, L=Unspecified, ST=Unspecified, C=US" \
        -ext "SAN=DNS:${NEXUS_DOMAIN},IP:${NEXUS_IP_ADDRESS}" \
        -ext "BC=ca:true"

Now you should have a file called keystore.jks We need to convert it to BASE64 encoding so that we can inject it as ENV var into the docker container

openssl base64 -in keystore.jks -out keystore.jks.base64 -A

(4) Trust the certificate on all clients

keytool -list -rfc -keystore keystore.jks  -storepass password

Displays the certificate. Copy paste it to your clients and trust the certs. See Docker Docs on SSL Trusting


 

Usage

(1) Create Nexus OSS Instance

NEXUS_DOMAIN="nexus.home.codeclou.io"
NEXUS_IP_ADDRESS="192.168.178.66"
NEXUS_KEYSTORE_JKS_BASE64=$(cat keystore.jks.base64)

docker create \
    --name nexus \
    -p 8443:8443 \
    -p 8444:8444 \
    -p 8445:8445 \
    -v /opt/nexus-oss-home:/nexus-home \
    -e NEXUS_DOMAIN="nexus.home.codeclou.io" \
    -e NEXUS_IP_ADDRESS="192.168.178.66" \
    -e NEXUS_KEYSTORE_JKS_BASE64=""$NEXUS_KEYSTORE_JKS_BASE64" \
    codeclou/docker-sonatype-nexus-repository-oss:3.5.0-02

docker start nexus

 

(2) Start Post Configuration

Now go to https://nexus.home.codeclou.io:8443/ and log in as admin with password admin123.

Configure the Instance to your liking.

 

(3) Docker Registry

The ports 8444 and 8445 can be used for docker registry Endpoints.


 

Trademarks and Third Party Licenses

  • Sonatype Nexus OSS
  • Apache Maven
  • Oracle Java JDK 8
    • Oracle and Java are registered trademarks of Oracle and/or its affiliates. Other names may be trademarks of their respective owners.
    • Please check yourself for corresponding Licenses and Terms of Use at www.oracle.com.
  • Docker
    • Docker and the Docker logo are trademarks or registered trademarks of Docker, Inc. in the United States and/or other countries. Docker, Inc. and other parties may also have trademark rights in other terms used herein.
    • Please check yourself for corresponding Licenses and Terms of Use at www.docker.com.
  • Ubuntu
  • Apple

 

License

MIT © Bernhard Grünewaldt

About

Dockerized Sonatype Nexus Repository Manager OSS ready to use as Proxy for most common Repositories.

Resources

License

Stars

Watchers

Forks

Packages

No packages published