Docker Community Forums

Share and learn in the Docker community.

New error in tag format

I have a “docker build” command line that has been running fine for quite a while. We very recently changed the format of one part of what goes into the tag value, and now we’re seeing the following error:

invalid argument "host:port/namespace/project:dev-latest-release/19-06-18-REL" for "-t, --tag" flag: invalid reference format

Everything before “dev-latest” is elided. We recently changed from “19.06.18.REL” to “19-06-18-REL”. I find it hard to believe this is what is causing this, but it’s the only thing that has changed.

I’ve done some more experimentation with this, and I can verify that the change from periods to dashes in the last name component don’t make any difference.

My only clue comes from the following statement in the “docker tag” documentation:

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.

The next to last name component has a “:” character, which isn’t in the list of valid characters. So, I tried changing that to either an underscore or a dash. The result from that is even more perplexing:

$ docker build -f src/main/docker/Dockerfile -t host:5100/name.space/servicems-dev-latest-release/19.06.18.REL .
invalid argument "host:5100/name.space/servicems-dev-latest-release/19.06.18.REL" for "-t, --tag" flag: invalid reference format: repository name must be lowercase
See 'docker build --help'.

Can someone help me get past this?

You don’t mention your original build command, nor which engine you are using. In any case, the typical format for image targets

<host<:port>/>namespace/repository<:tag>

I notice your format in the second build command is along the lines of

host:port/namespace/repo/repo

You may want to consider changing that target to
host:port/namespace/repo:tag
e.g.
host:5100/name.space/servicems-dev-latest-releast:19.06.18.REL

I think we’ve figured this out. The problem was that we’re putting the branch name into the tag, which was “release/19.06.18.REL”. We’ve now changed it so that the branch name value that contributes to the tag name is replacing forward slashes with dashes.

What is odd about this is that I can’t find any documentation that states this format you refer to. The “docker tag” documentation doesn’t talk about this. Does that relate the “engine” I’m using? I’m not even sure what that means.