使用Maven Fabric8插件将多个Docker映像保存到一个tar.gz文件中 [英] Save Multiple docker images into one tar.gz file with maven fabric8 plugin

查看:557
本文介绍了使用Maven Fabric8插件将多个Docker映像保存到一个tar.gz文件中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们正在使用io.fabric8:docker-maven-plugin:0.27.2构建docker映像.

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

我的maven项目由3个模块(module1module2module3)组成.每个模块都基于每个模块内存在的dockerfile构建一个docker映像.

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.

现在,当我运行mvn docker:save时-我想将所有3个docker映像保存到一个tar.gz文件myproject-1.0.0.tar.gz中.这个插件有可能吗?

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?

我的项目结构:

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

我正在使用io.fabric8:docker-maven-plugin:0.27.2

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

任何帮助将不胜感激!

推荐答案

您可以独立保存所有图像,然后使用maven程序集插件将它们打包到一个文件中.

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

根据文档:使用此插件只能在存档中保存一个图像.但是您可以对所有需要的映像执行docker:save(它将创建一些存档).而不是组装它们.

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.

这篇关于使用Maven Fabric8插件将多个Docker映像保存到一个tar.gz文件中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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