docker-compose.yml file and always pulling the last built image (without having a :latest tag)

  docker, docker-compose, tags

Some background:

I have a private docker registry running and working property.
I have a azure pipeline which builds and pushes the images I build from my repo via Dockerfiles.
The images are correctly tagged(according to the pipeline I have built) and it pushes the images to the docker registry.

This is good and I’m happy with this.

However, Whenever I want to provide my colleagues with a ‘customer’ version of a docker-compose.yml which pulls the images and setups the environment to run locally on their computer I have to specifically point-out which tag for each image to pull through the docker-compose.yml file. Thus always helping them out to update it whenever I have a new version of each image in the registry. This is inconvenient, but doable, but I would like to have a simpler solution(if possible)

My questions is:
Is it possible to write a generic docker-compose file which for example always pulls the last pushed image from the registry(not to be confused with a :latest tag which I currently don’t use)

Example(what I currently do with my colleagues docker-compose.yml file):

version: ‘3.3’

services:
  testimage:
    hostname: testimage
    image: my.private.registry.com/testimage:566
    volumes:
    ports:
      - '3000:3000'    

This example works, since I have an image in my registry that have this tag, but would it possible to express somehow inside the docker-compose.yml to always pull the last built image, which will not always be :566?

If that is the case, then how would look like?

Br
Magnus

Source: Docker Questions

LEAVE A COMMENT