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

Not able to customize nexus.properties

Open ngpadp12 opened this issue 2 years ago • 1 comments

In a dockerfile for nexus-app, I am trying to overwrite the nexus.properties file by copying a customized properties file over at /nexus-data/etc/ directory, after which the CMD directive runs and starts the nexus app.

COPY ./local-dir/nexus.template.properties ${NEXUS_DATA}/etc/nexus.properties

CMD ["sh", "-c", "${SONATYPE_DIR}/start-nexus-repository-manager.sh"]

This doesn't work however. The copy command works when i try to copy the template in the /home or /etc directories, but not when the COPY command runs on the /nexus-data or $SONATYPE_TYPE directories.

It seems that the start of nexus app (final command in the dockerfile) overwrites nexus.properties copied in the initial steps.

I would also like to know if there is an option/flag to pass an absolute custom path to the properties file (e.g. --config), I couldn't find any information about that either.

Any information about this would be of great help. If such customization is not possible for docker images, please suggest alternatives to implement this.

Thanks!

ngpadp12 avatar May 08 '22 20:05 ngpadp12

Hey, @ngpadp12 It is working for me: I have update the entrypoint with my custom nexus.properties file

Dockerfile:

FROM sonatype/nexus3
ADD ./nexus.properties /opt/sonatype
ENV NEXUS_CONTEXT="nexus"
USER root
RUN chmod +x ./start-nexus-repository-manager.sh
USER nexus
ENTRYPOINT [ "./start-nexus-repository-manager.sh" ]
EXPOSE 8081

docker-compose.yaml

version: "3.8"

services:
    
  nexus_web:
    container_name: nexus_web
    build:
      context: .
      dockerfile: Dockerfile    
    ports:
      - "8081:8081"
    volumes:
      - nexus_docker_data:/nexus-data
volumes:
  nexus_docker_data:

start-nexus-repository-manager.sh:

#!/bin/bash
mv /opt/sonatype/nexus.properties /nexus-data/etc/nexus.properties
cd /opt/sonatype/nexus
exec ./bin/nexus run

nexus.properties:

# Jetty section
# application-port=8081
# application-host=0.0.0.0
# nexus-args=${jetty.etc}/jetty.xml,${jetty.etc}/jetty-http.xml,${jetty.etc}/jetty-requestlog.xml
nexus-context-path=/${NEXUS_CONTEXT}

# Nexus section
# nexus-edition=nexus-pro-edition
# nexus-features=\
#  nexus-pro-feature

# nexus.hazelcast.discovery.isEnabled=true

Hope It helps!

vazand avatar Feb 16 '24 14:02 vazand