在使用dockerfile-maven-plugin打包镜像可谓是一波三折,和docker-maven-plugin完全不一样,笔者使用的环境又是win7系统,在win7系统上安装的docker toolbox,
代码语言:javascript复制 <plugin>
<groupId>com.spotify</groupId>
<artifactId>dockerfile-maven-plugin</artifactId>
<version>1.3.7</version>
<configuration>
<username>docker</username>
<password>tcuser</password>
<repository>${docker.repostory}/spring/start</repository>
<tag>${project.version}</tag>
<useMavenSettingsForAuth>true</useMavenSettingsForAuth>
<resources>
<resource>
<targetPath>/</targetPath>
<directory>${project.build.directory}</directory>
<include>${project.build.finalName}.jar</include>
</resource>
</resources>
</configuration>
</plugin>
上面的是dockerfile-maven-plugin的配置部分,通过mvn package dockerfile:build一直出现Caused by: com.spotify.docker.client.shaded.org.apache.http.ProtocolException: The server failed to respond with a valid HTTP response这个错误,这个错误是因为通信失败导致的,也就是使用mvn package dockerfile:build进行打包时没有找到tls通信证书导致的,最终解决方法将
C:Users当前登录用户.dockermachinecerts目录下所有文件拷贝到C:Users当前登录用户.docker目录