问题
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?
回答1:
you can create/ build your own image using a Dockerfile
extending the existing maven docker image i.e 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
来源:https://stackoverflow.com/questions/50057998/how-can-i-setup-an-official-maven-docker-image-with-my-own-global-settings-xml