如何使用 docker-compose 标记 docker 镜像 [英] How to tag docker image with docker-compose
本文介绍了如何使用 docker-compose 标记 docker 镜像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想通过 docker-compose 构建镜像并为其设置特定的标签.文档说:
I want to build image via docker-compose and set specific tag to it. Documentation says:
Compose 将使用生成的名称构建并标记它,并使用它之后的图像.
Compose will build and tag it with a generated name, and use that image thereafter.
但我找不到指定标签的方法,对于构建的图像,我总是看到最新"标签.
But I can't find a way to specify tag and for built images I always see 'latest' tag.
推荐答案
似乎文档/工具已更新,您现在可以将 image
标签添加到您的脚本中.这对我来说很成功.
It seems the docs/tool have been updated and you can now add the image
tag to your script. This was successful for me.
示例:
version: '2'
services:
baggins.api.rest:
image: my.image.name:rc2
build:
context: ../..
dockerfile: app/Docker/Dockerfile.release
ports:
...
https://docs.docker.com/compose/compose-file/#构建
这篇关于如何使用 docker-compose 标记 docker 镜像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文