我们是否有docker image build --iidfile的示例?

时间:2018-10-03 19:01:26

标签: docker docker-image

我正在运行脚本来构建Docker映像。我需要使用不同的标签将此图片推送到2个不同的存储库中。为此,我需要捕获并存储图像的构建ID。 Docker build documentation讨论了一种使用--iidfile将其存储在文件中的方法。

我们是否有相同的例子? 谢谢。

1 个答案:

答案 0 :(得分:1)

实际上,您不需要图像ID。只需在构建管道中使用docker tag现有映像即可创建其他“克隆”映像。示例:

docker build -t repo1/image:tag1 .
docker tag repo1/image:tag1 repo2/image:tag2
docker push repo1/image:tag1
docker push repo2/image:tag2