Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

docker build invalid tag

Tags:

git

docker

I'm trying to tag my docker image with the git branch name. I have this error: "invalid argument ... for "-t, --tag" flag: invalid reference format"

I converted branch name to lowercase but I still have this issue.

This is the error:

invalid argument "dockdgsp01:5000/lmr_controller_channel_plan:20201009-4131043-feature/pk-2631-implement-dwell-time-logic-in-the-lmr-controller" for "-t, --tag" flag: invalid reference format

where:

  • name: lmr_controller_channel_plan
  • date: 20201009
  • githash: 4131043
  • git branch: feature/pk-2631-implement-dwell-time-logic-in-the-lmr-controller

What is the error here? What are valid names (strings) for a docker tag?

like image 533
eduardosufan Avatar asked Sep 01 '25 20:09

eduardosufan


1 Answers

I believe your problem it the "/" between feature and pk.

If you are calling the command from a bash script you can try removing it like this:

variable=${variable//"/"/-}

Supposing that variable contains the string "feature/pk-2631-implement-dwell-time-logic-in-the-lmr-controller"

And then use it in your docker command as $variable

like image 70
aurelio remonda Avatar answered Sep 04 '25 22:09

aurelio remonda