使用私有 docker 鏡像倉庫 java
<properties> <docker.maintainer>統一Manven 版本依賴</docker.maintainer> <docker.imageName>parent</docker.imageName> </properties> <build> <plugins> <plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> </plugin> <plugin> <groupId>com.spotify</groupId> <artifactId>docker-maven-plugin</artifactId> <configuration> <serverId>docker-hub</serverId> <registryUrl>https://10.10.6.50:5000</registryUrl> <dockerHost>https://10.10.12.205:2376</dockerHost> <dockerCertPath>C:\Users\admin\.docker\machine\machines\manager</dockerCertPath> <imageName>10.10.6.50:5000/${docker.imageName}:${project.version}</imageName> <baseImage>java:8</baseImage> <maintainer>${docker.maintainer}</maintainer> <volumes>/tmp</volumes> <entryPoint>["java", "-jar", "/${project.build.finalName}.jar"]</entryPoint> <resources> <resource> <targetPath>/</targetPath> <directory>${project.build.directory}</directory> <include>${project.build.finalName}.jar</include> </resource> </resources> </configuration> </plugin> </plugins> </build>
maven setting.xml文件配置spring
<servers> <server> <id>docker-hub</id> <username>foo</username> <password>secret-password</password> <configuration> <email>foo@foo.bar</email> </configuration> </server> </servers> // email 也是必須填寫的