[英]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.我第一次将 docker 与 GitLab CI 结合使用。 I am happy that GitLab does most of the work for me.我很高兴 GitLab 为我完成了大部分工作。 I am using the official maven docker image maven:3-jdk-8
( https://hub.docker.com/_/maven/ )我正在使用官方 maven docker 镜像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.现在我想在该 docker 映像上设置全局settings.xml
,其中包含部署阶段到我的 nexus 服务器的数据。
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.我试图按照这个指南: 在 docker image 中添加目录和图像,但不幸的是我无法连接到 docker 图像的 bash。
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?如何将我自己的全局settings.xml
添加到我的 maven docker 镜像?
you can create/ build your own image using a Dockerfile
extending the existing maven docker image ie maven:3-jdk-8
in your case您可以使用扩展现有 maven Dockerfile
镜像的Dockerfile
创建/构建您自己的镜像,即maven:3-jdk-8
在您的情况下
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您可以有多个不同命名的settings.xml
(显然),您可以根据要求使用它们
like mvn <goal> -s /usr/share/maven/ref/settings-<somename>.xml
像mvn <goal> -s /usr/share/maven/ref/settings-<somename>.xml
goal and someone being different as per the usage目标和某人根据用法不同
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.