mercredi 10 février 2021

Docker : Running Maven in Docker container via current user as non-root

Maven needs the user home to download artifacts to, and if the user does not exist in the image an extra user.home Java property needs to be set.

For example, to run as user 1000 mounting the host' Maven repo

$ docker run -v ~/.m2:/var/maven/.m2 -ti --rm -u 1000 -e MAVEN_CONFIG=/var/maven/.m2 maven mvn -Duser.home=/var/maven archetype:generate
Source : https://hub.docker.com/_/maven
https://stackoverflow.com/questions/52780802/run-maven-in-docker-container-via-current-user/52781822

Aucun commentaire:

Enregistrer un commentaire

to criticize, to improve