Docker, maven and settings.xml Docker, maven and settings.xml docker docker

Docker, maven and settings.xml


I think the problem is actually the fact that the image I derive from maven:3.6.3-ibmjava-8-alpine already defines an ENTRYPOINT.

When I run docker run -it --rm my-image-mvn mvn clean install deploy it just works fine - good enough for me...

EDITBut I still wonder, why does that not work with ENTRYPOINT (or RUN)?

EDIT 2Ok, I finally get it, hope it will help somebody else. The maven's image uses an ENTRYPOINT with a shell script, which will make sure the settings.xml is placed into the correct directory. This happens only when you start a container instance.
In order to actually make it work for e.g. a RUN command, you have to do some of the work yourself.

Here is an example:

FROM maven:3.6.3-ibmjava-8-alpine AS maven-builder# Since we want to execute the mvn command with RUN (and not when the container gets started),# we have to do here some manual setup which would be made by the maven's entrypoint scriptRUN mkdir -p /root/.m2 \    && mkdir /root/.m2/repository# Copy maven settings, containing repository configurationsCOPY settings.xml /root/.m2...RUN mvn clean install