A Sonatype Nexus Repository Manager image based on Alpine with OpenJDK 8.
Running Nexus with:
docker run -d --name nexus \
-v /path/to/nexus-data:/nexus-data \
-p 8081:8081 \
-p 5000:5000 \
stefanprodan/nexus
Default credentials are: admin / admin123
It can take some time for the service to launch in a new container. You can tail the log to determine once Nexus is ready:
$ docker logs -f nexus
$ curl -u admin:admin123 http://localhost:8081/service/metrics/ping
Installation of Nexus is to /opt/sonatype/nexus-version.
A persistent directory, /nexus-data, is used for configuration, logs, and storage.
Three environment variables can be used to control the JVM arguments
JAVA_MAX_MEM, passed as -Xmx. Defaults to 1200m.
JAVA_MIN_MEM, passed as -Xms. Defaults to 1200m.
EXTRA_JAVA_OPTS. Additional options can be passed to the JVM via this variable.
nginx.conf
worker_processes 1;
events {
worker_connections 1024;
}
http {
error_log /var/log/nginx/error.log warn;
access_log /dev/null;
proxy_intercept_errors off;
proxy_send_timeout 120;
proxy_read_timeout 300;
upstream nexus {
server nexus:8081;
}
upstream registry {
server nexus:5000;
}
server {
listen 80;
server_name nexus.demo.com;
keepalive_timeout 5 5;
proxy_buffering off;
# allow large uploads
client_max_body_size 1G;
location / {
# redirect to docker registry
if ($http_user_agent ~ docker ) {
proxy_pass http://registry;
}
proxy_pass http://nexus;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto "https";
}
}
}
Replace nexus.demo.com with your own domain. The NGINX server detects if a call is made by the docker client, based on user agent, and redirects that call to the Docker Registry. You alose need to setup a certificate with letsencrypt for Docker Registry to work over SSL.
docker network create nexus-net
docker run -d --name nexus \
-v /path/to/nexus-data:/nexus-data \
--restart unless-stopped \
--network nexus-net \
stefanprodan/nexus
docker run -d -p 80:80 -p 443:443 --name nginx \
-v $(pwd)/nginx.conf:/etc/nginx/nginx.conf:ro \
--restart unless-stopped \
--network nexus-net \
nginx
Content type
Image
Digest
Size
155.1 MB
Last updated
over 9 years ago
docker pull jostyee/nexus