做技術(shù)分享網(wǎng)站有哪些手機軟文廣告300字
在使用docker-maven-plugin 插件時,經(jīng)常會碰到一些奇怪的問題:
比如:
1、docker遠程訪問時,認證安全問題?
2、dockerHost 訪問地址準確性?
3、需要多個tag時如何處理?
4、push 到倉庫時,需要保留歷史記錄問題?
反正各種問題,沒有找到任何相關(guān)資源能完整的說明,踩坑之后備忘,重點內(nèi)容直接詳細注釋說明:
<!--使用docker-maven-plugin插件-->
<plugin><groupId>com.spotify</groupId><artifactId>docker-maven-plugin</artifactId><version>1.2.2</version><configuration><imageName>${project.artifactId}:${project.version}</imageName><!-- 指定 Dockerfile 路徑--><dockerDirectory>${basedir}</dockerDirectory><!-- 這里的tag會在build環(huán)境中打上,支持多個tag--><imageTags><imageTag>latest</imageTag></imageTags><!-- 根據(jù)認證的情況,確保是否時http或https,默認2375對應(yīng)http,2376對應(yīng)https--><dockerHost>https://x.x.x.x:2376</dockerHost><!--如果docker 已經(jīng)做的安裝認證,這里需要放認證客戶端訪問需要的幾個文件:默認:ca.key,cert.pem,key.pem--><!--注意幾個文件的名稱必須為如上幾個默認的名稱,比如把上面幾個文件放在:/home/xxxx/cert--><dockerCertPath>/home/xxxx/cert</dockerCertPath><executions><execution><id>build-image</id><phase>package</phase><goals><goal>build</goal></goals></execution><execution><id>tag-image</id><phase>package</phase><goals><goal>tag</goal></goals><configuration><image>${project.artifactId}:${project.version}</image><newName>${docker.repostory}/${docker.registry.namespace}/${project.artifactId}:latest</newName></configuration></execution><execution><id>push-image</id><phase>verify</phase><goals><goal>push</goal></goals><configuration><!--如果有設(shè)置maven settting,這里是setting中的server id,如果自己的私服,也可以是任意值,請根據(jù)實際配置--><serverId>${docker.serverId}</serverId><imageName>${docker.repostory}/${docker.registry.namespace}/${project.artifactId}:latest</imageName><!--這里就可以在push 多個tag到倉庫,注意前提是已經(jīng)存在該tag的image--><imageTags><imageTag>${project.version}</imageTag><imageTag>latest</imageTag></imageTags></configuration></execution></executions>
</plugin>