Save Multiple docker images into one tar.gz file with maven fabric8 plugin

穿精又带淫゛_ 提交于 2019-12-11 07:22:03

问题


We are using io.fabric8:docker-maven-plugin:0.27.2 to build docker images.

my maven project consist of 3 modules (module1, module2 and module3). Each module builds a docker image based on the dockerfile present within each module.

Now, when I run mvn docker:save - I want to save all 3 docker images into one tar.gz file, myproject-1.0.0.tar.gz. Is it even possible with this plugin?

My Project Structure:

project
|-module1
  |-DockerFile1
  |-pom.xml
|-module2
  |-DockerFile2
  |-pom.xml
|-module3
  |-DockerFile3
  |-pom.xml
|-pom.xml

I'm using io.fabric8:docker-maven-plugin:0.27.2

<plugin>
 <groupId>io.fabric8</groupId>
 <artifactId>docker-maven-plugin</artifactId>
 <version>0.27.2</version>
 . . .

Any help is greatly appreciated!


回答1:


You can save all images independly and then use maven assembly plugin to pack them in one file.

According to the documentation: you can save only one image in archive using this plugin. But you can execute docker:save for all needed images (it will create a few archives). And than assemble them.



来源:https://stackoverflow.com/questions/53909282/save-multiple-docker-images-into-one-tar-gz-file-with-maven-fabric8-plugin

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!