docker-maven-elipse推送镜像(十四)
cookqq ›博客列表 ›docker+node.js+zookeeper构建微服务

docker-maven-elipse推送镜像(十四)

2018-08-30 14:28:16.0|分类: docker+node.js+zookeeper构建微服务|浏览量: 1412

摘要: docker-maven-elipse打包镜像,然后直接push镜像文件

eclipse打包镜像的过程已经说明了,可以查看

http://www.cookqq.com/blog/8a10a5f35d4a218301655f9dbdc20e3d


镜像打包好了,自动push到本地的docker registry中。


pom.xml配置

<groupId>com.cookqq</groupId>
  <artifactId>conca-hello</artifactId>
  <version>1.0.6</version>
  
  <properties>
  <docker.registry>192.168.99.100:50000</docker.registry>
  </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>
        <version>1.0.0</version>
        <configuration>
          <imageName>${docker.registry}/${project.groupId}/${project.artifactId}:${project.version}</imageName>
          <dockerDirectory>${project.build.outputDirectory}</dockerDirectory>
          <resources>
            <resource>
              <directory>${project.build.directory}</directory>
              <include>${project.build.finalName}.jar</include>
            </resource>
          </resources>
        </configuration>
      </plugin>
    </plugins>
  </build>


执行命令mvn docker:build docker:push

blob.png


运行之后,报错了

[INFO] Scanning for projects...

[INFO]                                                                         

[INFO] ------------------------------------------------------------------------

[INFO] Building Hello 1.0.6

[INFO] ------------------------------------------------------------------------

[INFO] 

[INFO] --- docker-maven-plugin:1.0.0:build (default-cli) @ conca-hello ---

[INFO] Using authentication suppliers: [ConfigFileRegistryAuthSupplier]

[INFO] Copying E:\workhome\workspaceMarsMvn\conca-hello\target\conca-hello-1.0.6.jar -> E:\workhome\workspaceMarsMvn\conca-hello\target\docker\conca-hello-1.0.6.jar

[INFO] Copying E:\workhome\workspaceMarsMvn\conca-hello\target\classes\application.properties -> E:\workhome\workspaceMarsMvn\conca-hello\target\docker\application.properties

[INFO] Copying E:\workhome\workspaceMarsMvn\conca-hello\target\classes\com\cookqq\controller\HelloController.class -> E:\workhome\workspaceMarsMvn\conca-hello\target\docker\com\cookqq\controller\HelloController.class

[INFO] Copying E:\workhome\workspaceMarsMvn\conca-hello\target\classes\com\cookqq\HelloApplication.class -> E:\workhome\workspaceMarsMvn\conca-hello\target\docker\com\cookqq\HelloApplication.class

[INFO] Copying E:\workhome\workspaceMarsMvn\conca-hello\target\classes\com\cookqq\registry\RegistryConfig.class -> E:\workhome\workspaceMarsMvn\conca-hello\target\docker\com\cookqq\registry\RegistryConfig.class

[INFO] Copying E:\workhome\workspaceMarsMvn\conca-hello\target\classes\com\cookqq\registry\ServiceRegistry.class -> E:\workhome\workspaceMarsMvn\conca-hello\target\docker\com\cookqq\registry\ServiceRegistry.class

[INFO] Copying E:\workhome\workspaceMarsMvn\conca-hello\target\classes\com\cookqq\registry\ServiceRegistryImpl.class -> E:\workhome\workspaceMarsMvn\conca-hello\target\docker\com\cookqq\registry\ServiceRegistryImpl.class

[INFO] Copying E:\workhome\workspaceMarsMvn\conca-hello\target\classes\com\cookqq\registry\WebListenter.class -> E:\workhome\workspaceMarsMvn\conca-hello\target\docker\com\cookqq\registry\WebListenter.class

[INFO] Copying E:\workhome\workspaceMarsMvn\conca-hello\target\classes\Dockerfile -> E:\workhome\workspaceMarsMvn\conca-hello\target\docker\Dockerfile

[INFO] Copying E:\workhome\workspaceMarsMvn\conca-hello\target\classes\META-INF\MANIFEST.MF -> E:\workhome\workspaceMarsMvn\conca-hello\target\docker\META-INF\MANIFEST.MF

[INFO] Copying E:\workhome\workspaceMarsMvn\conca-hello\target\classes\META-INF\maven\com.cookqq\conca-hello\pom.properties -> E:\workhome\workspaceMarsMvn\conca-hello\target\docker\META-INF\maven\com.cookqq\conca-hello\pom.properties

[INFO] Copying E:\workhome\workspaceMarsMvn\conca-hello\target\classes\META-INF\maven\com.cookqq\conca-hello\pom.xml -> E:\workhome\workspaceMarsMvn\conca-hello\target\docker\META-INF\maven\com.cookqq\conca-hello\pom.xml

[INFO] Building image 192.168.99.100:50000/com.cookqq/conca-hello:1.0.6

Step 1/5 : FROM java:8


 ---> d23bdf5b1b1b

Step 2/5 : MAINTAINER "conca"<136641953@qq.com>


 ---> Using cache

 ---> 0fffcb4e5688

Step 3/5 : ADD conca-hello-1.0.6.jar app.jar


 ---> Using cache

 ---> a0e1c3778c0f

Step 4/5 : EXPOSE 8080


 ---> Using cache

 ---> 458ab8b1fd3f

Step 5/5 : CMD java -jar app.jar


 ---> Using cache

 ---> 67e6b8b23312

ProgressMessage{id=null, status=null, stream=null, error=null, progress=null, progressDetail=null}

Successfully built 67e6b8b23312

Successfully tagged 192.168.99.100:50000/com.cookqq/conca-hello:1.0.6

[INFO] Built 192.168.99.100:50000/com.cookqq/conca-hello:1.0.6

[INFO] 

[INFO] --- docker-maven-plugin:1.0.0:push (default-cli) @ conca-hello ---

[INFO] Using authentication suppliers: [ConfigFileRegistryAuthSupplier]

[INFO] Pushing 192.168.99.100:50000/com.cookqq/conca-hello:1.0.6

The push refers to repository [192.168.99.100:50000/com.cookqq/conca-hello]

[WARNING] Failed to push 192.168.99.100:50000/com.cookqq/conca-hello:1.0.6, retrying in 10 seconds (1/5).

[INFO] Pushing 192.168.99.100:50000/com.cookqq/conca-hello:1.0.6

The push refers to repository [192.168.99.100:50000/com.cookqq/conca-hello]

[WARNING] Failed to push 192.168.99.100:50000/com.cookqq/conca-hello:1.0.6, retrying in 10 seconds (2/5).

[INFO] Pushing 192.168.99.100:50000/com.cookqq/conca-hello:1.0.6

The push refers to repository [192.168.99.100:50000/com.cookqq/conca-hello]

[WARNING] Failed to push 192.168.99.100:50000/com.cookqq/conca-hello:1.0.6, retrying in 10 seconds (3/5).

[INFO] Pushing 192.168.99.100:50000/com.cookqq/conca-hello:1.0.6

The push refers to repository [192.168.99.100:50000/com.cookqq/conca-hello]

[WARNING] Failed to push 192.168.99.100:50000/com.cookqq/conca-hello:1.0.6, retrying in 10 seconds (4/5).

[INFO] Pushing 192.168.99.100:50000/com.cookqq/conca-hello:1.0.6

The push refers to repository [192.168.99.100:50000/com.cookqq/conca-hello]

[WARNING] Failed to push 192.168.99.100:50000/com.cookqq/conca-hello:1.0.6, retrying in 10 seconds (5/5).

[INFO] Pushing 192.168.99.100:50000/com.cookqq/conca-hello:1.0.6

The push refers to repository [192.168.99.100:50000/com.cookqq/conca-hello]

[INFO] ------------------------------------------------------------------------

[INFO] BUILD FAILURE

[INFO] ------------------------------------------------------------------------

[INFO] Total time: 1:07.038s

[INFO] Finished at: Wed Aug 22 16:32:29 CST 2018

[INFO] Final Memory: 18M/277M

[INFO] ------------------------------------------------------------------------

[ERROR] Failed to execute goal com.spotify:docker-maven-plugin:1.0.0:push (default-cli) on project conca-hello: Exception caught: Get https://192.168.99.100:50000/v2/: http: server gave HTTP response to HTTPS client -> [Help 1]

[ERROR] 

[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.

[ERROR] Re-run Maven using the -X switch to enable full debug logging.

[ERROR] 

[ERROR] For more information about the errors and possible solutions, please read the following articles:

[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException


访问https://192.168.99.100:50000/v2/失败,浏览器访问http://192.168.99.100:50000/v2

blob.png

怎么就失败了呢??

我的环境是win7+eclipse+docker+registry.

我的潜意识认为这个docker.registry是我win7机器访问的地址,当我看到镜像列表的时候,我恍然大悟:docker.registry是指在docker机器上访问的地址。

blob.png


把pom.xml配置修成

<properties>

  <docker.registry>192.168.99.100:50000</docker.registry>

  </properties>


再次运行命令,正确通过。

[INFO] Scanning for projects...

[INFO]                                                                         

[INFO] ------------------------------------------------------------------------

[INFO] Building Hello 1.0.6

[INFO] ------------------------------------------------------------------------

[INFO] 

[INFO] --- docker-maven-plugin:1.0.0:build (default-cli) @ conca-hello ---

[INFO] Using authentication suppliers: [ConfigFileRegistryAuthSupplier]

[INFO] Copying E:\workhome\workspaceMarsMvn\conca-hello\target\conca-hello-1.0.6.jar -> E:\workhome\workspaceMarsMvn\conca-hello\target\docker\conca-hello-1.0.6.jar

[INFO] Copying E:\workhome\workspaceMarsMvn\conca-hello\target\classes\application.properties -> E:\workhome\workspaceMarsMvn\conca-hello\target\docker\application.properties

[INFO] Copying E:\workhome\workspaceMarsMvn\conca-hello\target\classes\com\cookqq\controller\HelloController.class -> E:\workhome\workspaceMarsMvn\conca-hello\target\docker\com\cookqq\controller\HelloController.class

[INFO] Copying E:\workhome\workspaceMarsMvn\conca-hello\target\classes\com\cookqq\HelloApplication.class -> E:\workhome\workspaceMarsMvn\conca-hello\target\docker\com\cookqq\HelloApplication.class

[INFO] Copying E:\workhome\workspaceMarsMvn\conca-hello\target\classes\com\cookqq\registry\RegistryConfig.class -> E:\workhome\workspaceMarsMvn\conca-hello\target\docker\com\cookqq\registry\RegistryConfig.class

[INFO] Copying E:\workhome\workspaceMarsMvn\conca-hello\target\classes\com\cookqq\registry\ServiceRegistry.class -> E:\workhome\workspaceMarsMvn\conca-hello\target\docker\com\cookqq\registry\ServiceRegistry.class

[INFO] Copying E:\workhome\workspaceMarsMvn\conca-hello\target\classes\com\cookqq\registry\ServiceRegistryImpl.class -> E:\workhome\workspaceMarsMvn\conca-hello\target\docker\com\cookqq\registry\ServiceRegistryImpl.class

[INFO] Copying E:\workhome\workspaceMarsMvn\conca-hello\target\classes\com\cookqq\registry\WebListenter.class -> E:\workhome\workspaceMarsMvn\conca-hello\target\docker\com\cookqq\registry\WebListenter.class

[INFO] Copying E:\workhome\workspaceMarsMvn\conca-hello\target\classes\Dockerfile -> E:\workhome\workspaceMarsMvn\conca-hello\target\docker\Dockerfile

[INFO] Copying E:\workhome\workspaceMarsMvn\conca-hello\target\classes\META-INF\MANIFEST.MF -> E:\workhome\workspaceMarsMvn\conca-hello\target\docker\META-INF\MANIFEST.MF

[INFO] Copying E:\workhome\workspaceMarsMvn\conca-hello\target\classes\META-INF\maven\com.cookqq\conca-hello\pom.properties -> E:\workhome\workspaceMarsMvn\conca-hello\target\docker\META-INF\maven\com.cookqq\conca-hello\pom.properties

[INFO] Copying E:\workhome\workspaceMarsMvn\conca-hello\target\classes\META-INF\maven\com.cookqq\conca-hello\pom.xml -> E:\workhome\workspaceMarsMvn\conca-hello\target\docker\META-INF\maven\com.cookqq\conca-hello\pom.xml

[INFO] Building image 127.0.0.1:50000/com.cookqq/conca-hello:1.0.6

Step 1/5 : FROM java:8


 ---> d23bdf5b1b1b

Step 2/5 : MAINTAINER "conca"<136641953@qq.com>


 ---> Running in 4fe645bb19d9

Removing intermediate container 4fe645bb19d9

 ---> 7a0147546d35

Step 3/5 : ADD conca-hello-1.0.6.jar app.jar


 ---> 231431d9d933

Step 4/5 : EXPOSE 8080


 ---> Running in 567d580a5011

Removing intermediate container 567d580a5011

 ---> ca6502d508d1

Step 5/5 : CMD java -jar app.jar


 ---> Running in 5b0442d99431

Removing intermediate container 5b0442d99431

 ---> e858ba87443c

ProgressMessage{id=null, status=null, stream=null, error=null, progress=null, progressDetail=null}

Successfully built e858ba87443c

Successfully tagged 127.0.0.1:50000/com.cookqq/conca-hello:1.0.6

[INFO] Built 127.0.0.1:50000/com.cookqq/conca-hello:1.0.6

[INFO] 

[INFO] --- docker-maven-plugin:1.0.0:push (default-cli) @ conca-hello ---

[INFO] Using authentication suppliers: [ConfigFileRegistryAuthSupplier]

[INFO] Pushing 127.0.0.1:50000/com.cookqq/conca-hello:1.0.6

The push refers to repository [127.0.0.1:50000/com.cookqq/conca-hello]

20af1f4b3358: Preparing 

35c20f26d188: Preparing 

c3fe59dd9556: Preparing 

6ed1a81ba5b6: Preparing 

a3483ce177ce: Preparing 

ce6c8756685b: Preparing 

30339f20ced0: Preparing 

0eb22bfb707d: Preparing 

a2ae92ffcd29: Preparing 



ce6c8756685b: Waiting 



30339f20ced0: Waiting 



0eb22bfb707d: Waiting 



a2ae92ffcd29: Waiting 



35c20f26d188: Layer already exists 



6ed1a81ba5b6: Layer already exists 



c3fe59dd9556: Layer already exists 



0eb22bfb707d: Layer already exists 



a3483ce177ce: Layer already exists 



20af1f4b3358: Layer already exists 



30339f20ced0: Layer already exists 



ce6c8756685b: Layer already exists 



a2ae92ffcd29: Layer already exists 

1.0.6: digest: sha256:b95ed0b19ee90ee68217356bd64aad204a02cdc2832b03b0b531406831370c3d size: 2212

null: null 

[INFO] ------------------------------------------------------------------------

[INFO] BUILD SUCCESS

[INFO] ------------------------------------------------------------------------

[INFO] Total time: 17.804s

[INFO] Finished at: Wed Aug 22 16:59:22 CST 2018

[INFO] Final Memory: 18M/285M

[INFO] ------------------------------------------------------------------------



一键分享文章

分类列表

  • • struts源码分析
  • • flink
  • • struts
  • • redis
  • • kafka
  • • ubuntu
  • • zookeeper
  • • hadoop
  • • activiti
  • • linux
  • • 成长
  • • NIO
  • • 关键词提取
  • • mysql
  • • android studio
  • • zabbix
  • • 云计算
  • • mahout
  • • jmeter
  • • hive
  • • ActiveMQ
  • • lucene
  • • MongoDB
  • • netty
  • • flume
  • • 我遇到的问题
  • • GRUB
  • • nginx
  • • 大家好的文章
  • • android
  • • tomcat
  • • Python
  • • luke
  • • android源码编译
  • • 安全
  • • MPAndroidChart
  • • swing
  • • POI
  • • powerdesigner
  • • jquery
  • • html
  • • java
  • • eclipse
  • • shell
  • • jvm
  • • highcharts
  • • 设计模式
  • • 列式数据库
  • • spring cloud
  • • docker+node.js+zookeeper构建微服务
版权所有 cookqq 感谢访问 支持开源 京ICP备15030920号
CopyRight 2015-2018 cookqq.com All Right Reserved.