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.
This question is related to
docker
docker-compose
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
build: ./dir
image: webapp:tag
If you specify image as well as build, then Compose names the built image with the webapp and optional tag specified in image:
build: ./dir
image: webapp:tag
This results in an image named webapp
and tagged tag
, built from ./dir
.
you can try:
services:
nameis:
container_name: hi_my
build: .
image: hi_my_nameis:v1.0.0
Source: Stackoverflow.com