Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to tag docker image with docker-compose

People also ask

How do I tag a docker image?

A tag name must be valid ASCII and may contain lowercase and uppercase letters, digits, underscores, periods and dashes. A tag name may not start with a period or a dash and may contain a maximum of 128 characters.

How do you tag an image?

If you want to tag a new image as you upload it, click the Edit button in the top-left corner of the post, then select Tag photo from the left side. Either way, once you're in tagging mode, place a tag by clicking on the person's face that you want to tag.

Does a docker image need a tag?

We can also build a Docker image without using any tag. Here, in the above command, we built the image without any tag, so By default, Docker provides a tag to the image as the latest “baeldung-java:latest”. Docker always points to the latest stable release using the latest tag.

How do I map a custom tag for an image in docker?

You can pull a Docker Image using the pull sub-command. You can specify the tag of the Image that you want to pull. Note that if you don't specify a tag, it will automatically pull the latest version of the Image by appending the “latest” tag to the 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.

Example:

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/#build


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.

https://docs.docker.com/compose/compose-file/#build


you can try:

services:
  nameis:
    container_name: hi_my
    build: .
    image: hi_my_nameis:v1.0.0