通过Maven我想从Springboot项目构建一个Docker镜像。 我运行:mvn clean package docker:build 问题:
ERROR] Failed to execute goal io.fabric8:docker-maven-plugin:0.21.0:build (default-cli) on project spring-boot-docker: Execution default-cli of goal io.fabric8:docker-maven-plugin:0.21.0:build failed: An API incompatibility was encountered while executing io.
fabric8:docker-maven-plugin:0.21.0:build: java.lang.UnsatisfiedLinkError: unknown
[ERROR] -----------------------------------------------------
[ERROR] realm = plugin>io.fabric8:docker-maven-plugin:0.21.0
[ERROR] strategy = org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy
[ERROR] urls[0] = file:/C:/Users/Johan/.m2/repository/io/fabric8/docker-maven-plugin/0.21.0/docker-maven-plugin-0.21.0.jar
Etc
maven pom.xml文件包含:
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<java.version>1.8</java.version>
<docker.image.prefix>springframeworkguru</docker.image.prefix>
<docker.image.name>springbootdocker</docker.image.name>
<docker.host.url>unix:///var/run/docker.sock</docker.host.url>
</properties>
构建插件部分包含:
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>io.fabric8</groupId>
<artifactId>docker-maven-plugin</artifactId>
<version>0.21.0</version>
<configuration>
<dockerHost>${docker.host.url}</dockerHost>
<verbose>true</verbose>
<images>
<image>
<name>${docker.image.prefix}/${docker.image.name}</name>
<build>
<dockerFileDir>${project.basedir}/src/main/docker/</dockerFileDir>
<assembly>
<descriptorRef>artifact</descriptorRef>
</assembly>
<tags>
<tag>latest</tag>
<tag>${project.version}</tag>
</tags>
</build>
</image>
</images>
</configuration>
</plugin>
</plugins>
</build>
正如所建议的,我删除了我的maven存储库,但没有帮助。 使用其他dockerHost值(如http://127.0.0.1:2375)没有帮助。
我真的希望你能帮忙!
答案 0 :(得分:3)
这是Windows 7,8和10主页上的解决方案: