2017-09-05 1 views
0

Via Maven Je voudrais construire une image Docker à partir d'un projet Springboot. je lance: mvn package propre docker: construire Problème:Docker maven fabric8 plugin (sous Windows): l'image de construction pose des problèmes d'incompatibilité?

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 

Le fichier pom.xml Maven contient:

<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> 

La construction section plugin contient:

<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> 

Comme suggéré , J'ai enlevé mon référentiel maven, ce qui n'a pas aidé. L'utilisation d'autres valeurs dockerHost (comme http://127.0.0.1:2375) n'a pas aidé. Je souhaite vraiment que vous pouvez aider!

+0

Quelle version Maven-vous utilisation? – khmarbaise

+0

@khmarbaise - merci de demander. Après avoir encore voyagé aux extrémités de l'Internet, j'ai trouvé la réponse, voir ci-dessous. – tjm1706

Répondre

1

C'est la solution sous Windows 7, 8 et 10 Accueil:

  • Trouver les variables d'environnement de la machine docker. Allez dans le docker (shell) et tapez: docker-machine env. L'hôte docker et le chemin de certification sont importants.
  • Ajoutez les propriétés suivantes à votre fichier pom.xml (Maven):
    • <docker.host.url> (par exemple) tcp: //192.168.99.100: 2376 </docker.host.url>
    • <docker.host.certPath> (par exemple) un chemin </docker.host.certPath>
  • Dans votre build plugin ajouter juste après la configuration
    • <dockerHost> $ {} docker.host.url </dockerHost >
    • <CertPath> $ {} docker.host.certPath </CertPath >