Open nghamilton opened 7 years ago
If you pass an environment variable at launch, this will set the context path correctly as shown in the logs:
org.sonatype.nexus.bootstrap.ConfigurationBuilder - nexus-webapp-context-path='/'
From the notes section of the readme:
Environment variables can be used to control the JVM arguments
CONTEXT_PATH, passed as -Dnexus-webapp-context-path. This is used to define the URL which Nexus is accessed. Defaults to '/nexus'
So try this and see if it works for you:
docker run -d -p 8081:8081 --name nexus -e CONTEXT_PATH=/ sonatype/nexus
That should work on localhost:8081
Just for future reference, the main issue here is /
at CONTEXT_PATH
environment variable.
./etc/nexus.properties
file sets nexus-context-path as below;
nexus-context-path=/${NEXUS_CONTEXT}
So if you set CONTEXT_PATH=/nexus
nexus starts with log below;
INFO [FelixStartLevel] *SYSTEM org.sonatype.nexus.bootstrap.ConfigurationBuilder - nexus-context-path='//nexus'
So curl localhost:8081/nexus
fails
but
curl localhost:8081//nexus
works.
So, solution is setting NEXUS_CONTEXT
as nexus
, without /
Setting the context path using NEXUS_CONTEXT causes a 404 error when using the nexus3 image:
Problem accessing /. Reason: Not Found
The logs indicate it is set properly (using NEXUS_CONTEXT=nexus/content)
nexus-context-path='/nexus/content'