docker-nexus icon indicating copy to clipboard operation
docker-nexus copied to clipboard

404 error when changing NEXUS_CONTEXT environment variable

Open nghamilton opened this issue 7 years ago • 2 comments

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'

nghamilton avatar Aug 30 '17 16:08 nghamilton

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

virtualbeck avatar Nov 02 '18 13:11 virtualbeck

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 /

srknc avatar Oct 12 '19 13:10 srknc