I want to build image via docker-compose and set specific tag to it. Documentation says:
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.
Original answer Nov 20 '15:
No option for a specific tag as of Today. Docker compose just does its magic and assigns a tag like you are seeing. You can always have some script call
docker tag <image> <tag>
after you call docker-compose.Now there's an option as described above or here
It seems the docs/tool have been updated and you can now add the
image
tag to your script. This was successful for me.Example:
https://docs.docker.com/compose/compose-file/#build
If you specify image as well as build, then Compose names the built image with the webapp and optional tag specified in image:
This results in an image named
webapp
and taggedtag
, built from./dir
.https://docs.docker.com/compose/compose-file/#build