是否可以确保仅创建带有多个标签的单个Docker映像,并且如何在docker push命令之后使这些标签显示在Docker存储库(JFrog)中?
一个相关的问题,我曾经在构建时一次添加多个标签: https://stackoverflow.com/a/35565384/3762850
我的bash脚本:
#!/bin/bash
target_image="<my-remote-site>:8081/<docker-artifactory>/<repository-key>"
tag_a="First-Tag"
tag_b="Second-Tag"
sudo docker login -u <user-name>-p <user-password> <my-remote-site>:8081
sudo docker build -t "${target_image}:${tag_a}" -t "${target_image}:${tag_b}" .
sudo docker push "${target_image}:${tag_a}" "${target_image}:${tag_b}"
答案 0 :(得分:0)
docker标签有助于将标签放置到图像上。可以用来创建带有先前标签的新标签。
#!/bin/bash
target_image="<my-remote-site>:8081/<docker-artifactory>/<repository-key>"
tag_a="First-Tag"
tag_b="Second-Tag"
sudo docker login -u <user-name>-p <user-password> <my-remote-site>:8081
sudo docker build -t "${target_image}:${tag_a}" .
sudo docker tag "${target_image}:${tag_a}" "${target_image}:${tag_b}"
sudo docker push "${target_image}:${tag_a}" "${target_image}:${tag_b}"