Add new docker image tag to existing docker image on promotion?


I’ve been successfully running Drone on a new project for the last few months with very little issue, but now I’m starting to build out my deployment pipeline and upon promoting a build from say dev =-> QA I would like to take the docker image previously built and used in dev and simply add a new tag to the docker image upon promotion.

For example I have the following dev tag that was build in build 201 ‘frontend:master_2021-11-22.201’ during a promotion into QA I want to add a new image tag which will produce the following… frontend:qa_2021-11-22.201

I have taken a look at the standard docker plugin, but that seems to just want to build new images :confused:

Can anyone provide any guidance or point me at a suitable example I can tailor to my own needs?

You are correct that the purpose of the docker plugin is to safely build and push images to a docker registry using docker-in-docker. The docker plugin was not designed to perform all docker tasks, just build and publish. If you have other needs, you always have the option to fallback to scripting (below) or you can create your own plugin that encapsulates your logic [1]

kind: pipeline
name: default

- name: tag
  image: docker:dind
  - name: dockersock
    path: /var/run/docker.sock
  - docker login ...
  - docker tag ...
  - docker push ...

- name: dockersock
    path: /var/run/docker.sock



1 Like

Cool… as a short term win, think I’ll go with the scripting.

Longer term, I’ll look into building a suitable plugin :slight_smile:

Cheers :pray: