简体   繁体   中英

Dockerfile maven with ARG

On my dockerfile, i try to run this command line

RUN mvn install -Djavax.net.ssl.trustStore=/app/store -Djavax.net.ssl.trustStorePassword=password

It doesn't work :(. I have this error

[FATAL] Non-resolvable parent POM for org.springframework:java-backend-bdd:0.1.0: Could not transfer artifact org.springframework.boot:spring-boot-starter-parent:pom:2.0.3.RELEASE from/to central ( https://repo.maven.apache.org/maven2 ): sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target and 'parent.relativePath' points at wrong local POM @ line 13, column 13

I can put anything on the arguments -Djavax.net.ssl.trustStore or -Djavax.net.ssl.trustStorePassword, same error

I also try this command line

 RUN ["mvn", "install","-Djavax.net.ssl.trustStore=/app/store", "-Djavax.net.ssl.trustStorePassword=password"]

How can i run maven with argument on Dockerfile ?

Your first command should work fine. No need to split the run into an array of args.

However, did you copy the cert into the Docker container first? If the cert is in the repo, you'll need to add a line like

RUN mkdir /app/store
COPY /my/local/cert/store/ /app/store

This will copy the contents of your local cert store to the /app/store path in the docker container.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM