Docker Maven fabric8插件(在Windows上):构建映像会出现不兼容问题? [英] Docker maven fabric8 plugin (on Windows): building image gives incompatibility issues ?

查看:303
本文介绍了Docker Maven fabric8插件(在Windows上):构建映像会出现不兼容问题?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

通过Maven我想从Springboot项目构建Docker映像. 我运行:mvn clean package docker:build 问题:

Via Maven I would like to build a Docker image from a Springboot project. I run: mvn clean package docker:build Issue:

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文件包含:

The maven pom.xml file contains:

<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 )无济于事.

As suggested, I removed my maven repository, which did not help. Using other dockerHost values (like http://127.0.0.1:2375) did not help.

我真的希望你能提供帮助!

I really hope you can help!

推荐答案

这是Windows 7、8和10 Home上的解决方案:

This is the solution on Windows 7, 8 and 10 Home:

  • 找到docker机器环境变量.转到docker(shell)并输入:docker-machine env. docker主机和认证路径很重要.
  • 将以下属性添加到pom.xml(maven)文件中:
    • < docker.host.url>(例如tcp://192.168.99.100:2376</docker.host.url>
    • < docker.host.certPath>(例如,路径)</docker.host.certPath>
    • Find the docker machine environment variables. Go to the docker (shell) and type: docker-machine env. The docker host and certification path are important.
    • Add the following properties to your pom.xml (maven) file:
      • <docker.host.url>(e.g.) tcp://192.168.99.100:2376</docker.host.url>
      • <docker.host.certPath>(e.g.) a path</docker.host.certPath>
      • < dockerHost> $ {docker.host.url}</dockerHost>
      • < certPath> $ {docker.host.certPath}</certPath>

      这篇关于Docker Maven fabric8插件(在Windows上):构建映像会出现不兼容问题?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆