准备文件
settings-docker.xml
<?xml version="1.0" encoding="UTF-8"?>
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">
<mirrors>
<mirror>
<!--替换成自己的配置-->
</mirror>
</mirrors>
<servers>
<server>
<!--替换成自己的配置-->
</server>
</servers>
</settings>
settings.xml
<?xml version="1.0" encoding="UTF-8"?>
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">
<mirrors>
<mirror>
<!--替换成自己的配置-->
</mirror>
</mirrors>
<servers>
<server>
<!--替换成自己的配置-->
</server>
</servers>
</settings>
编写Dockerfile文件
FROM lyaprotect/maven3.6.3-openjdk-17-graphviz:master-latest
COPY settings.xml /usr/share/maven/ref/
COPY settings-docker.xml /usr/share/maven/ref/
COPY settings.xml /usr/share/maven/conf/settings.xml