简体   繁体   中英

How can I setup an official maven docker image with my own global settings.xml?

I use docker for the first time in connection with GitLab CI. I am happy that GitLab does most of the work for me. I am using the official maven docker image maven:3-jdk-8 ( https://hub.docker.com/_/maven/ )

Now I would like to set the global settings.xml on that docker image, which contains data to my nexus server for the deploy phase.

I tried to follow this guide: Adding a directory and image in the docker image , but unfortunally I cannot connect to the bash of the docker image.

root@build:~# docker run maven:3-jdk-8 /bin/bash -it
bash: cannot set terminal process group (-1): Inappropriate ioctl for device
bash: no job control in this shell
root@7d62e8b066f7:/# exit

How can I add my own global settings.xml to my maven docker image?

you can create/ build your own image using a Dockerfile extending the existing maven docker image ie maven:3-jdk-8 in your case

And in there you can add a line something like below:-

COPY settings.xml /usr/share/maven/ref/

You can have multiple settings.xml named differently(obviously) and you can use them as per the requirements

like mvn <goal> -s /usr/share/maven/ref/settings-<somename>.xml

goal and someone being different as per the usage

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