Invalid argument "/tensorflow-serving-devel" for "-t,--tag" flag:Invalid reference format
Asked Answered
C

4

5

I am trying to create a docker Image for tensforflow serving like here.

When i try to pull docker image with all the required dependencies(pip dependencies, bazel, grpc) enter image description here

What am i doing wrong here? I believe it works for everyone except me. i am using docker toolbox in windows 7 and this is my first time using docker. I don't know what this error says

edit: after removing the space enter image description here

Docker version

enter image description here

Cyd answered 19/3, 2018 at 7:13 Comment(0)
K
7

There is a typo in your docker build command: a space is after Dockerfile word.

The correct command is:

docker build --pull -t $USER/tensorflow-serving-devel -f tensorflow_serving/tools/docker/Dockerfile.devel .

EDIT:

I see where your problem is. You use Windows, so $USER is not resolves to username. Please change it to something else like:

docker build --pull -t user/tensorflow-serving-devel -f tensorflow_serving/tools/docker/Dockerfile.devel .

And then use it with docker run command:

docker run --name=tensorflow_container -it user/tensorflow-serving-devel
Kerosene answered 19/3, 2018 at 8:27 Comment(4)
Docker version 18.02.0 -ce, buildCyd
@dhinar Added additional info.Kerosene
I have added a pic above,is that enoughCyd
@dhinar Please read my answer one more time. I added additional info there.Kerosene
F
5

The problem is that $USER is expanding to an empty string, since there is no environment variable USER.

To solve the issue just replace the $USER with your Dockerhub username or any username. You can also just change $USER/tensorflow-serving-devel to tensorflow-serving-devel. It really doesn't matter since this is only the name of the resulting image.

Fishnet answered 19/3, 2018 at 8:46 Comment(1)
Had same issue, one of my variables was not being expanded. Going to debug that now, hahaZaratite
G
1

In my case with the same error, the problem was with combination of "-" and "_" symbols placed together in the image tag. So image tag like MMT-6352_-_fix is invalid, but image tag like MMT-6352_fix or MMT-6352-fix is valid.

Goofball answered 23/7, 2019 at 11:51 Comment(0)
A
0

In my case, I am creating an environment variable with hash of recent git commit, and this hash value will be the tag of my docker image I'm going to build.

So my file(say deploy.sh) looked like this:

GIT_SHA = $(git rev-parse HEAD)
docker build -t user/myimage:$GIT_SHA

Then, I got error saying

deploy.sh: line 2: GIT_SHA: command not found
invalid argument "user/myimage:" for "-t, --tag" flag: invalid reference format
See 'docker build --help'.

I fixed it by removing the spaces before and after = as follows:

GIT_SHA=$(git rev-parse HEAD)
docker build -t user/myimage:$GIT_SHA
Adjudication answered 8/5, 2021 at 6:7 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.