0

I am getting this error:

docker: invalid reference format.
See 'docker run --help'.

I have this:

docker run --rm   \
    "$ecr_endpoint/notifier-cli:latest"                \
    --build-exit-code "$exit_code"                     \
    --event 'build-end'

the exit status of the docker run command is 125, if that helps. I have no idea what's going on here...an identical command is running fine earlier in the script.

the Dockerfile is like so:

FROM node:12

USER root

WORKDIR /app

COPY . .

ENTRYPOINT ["node", "main.js"]

CMD []
  • It may be easier to show this command without the variables but instead with some dummy content that also produces the same error. – tadman May 19 '19 at 01:02
  • yeah let me see if I get the same error without the env vars –  May 19 '19 at 01:02
  • yeah same error even w/o env vars, updated OP –  May 19 '19 at 01:03
  • Does [this question](https://stackoverflow.com/questions/45682010/docker-invalid-reference-format) seem like a related problem? It seems to be an issue with any sort of variable interpolation, even `$ecr_..` – tadman May 19 '19 at 01:04
  • I think ecr_endpoint is undefined lol, that's the problem, really shitty docker cli error message tho, tbh. feck that error message lol. –  May 19 '19 at 01:04
  • Careful with the phrasing here. – tadman May 19 '19 at 01:05
  • You know who should be careful is the people raising crappy error messages :) Not you, but Docker people obviously –  May 19 '19 at 01:09
  • It's [open source](https://github.com/docker/cli) so if this really burns your britches you can always fix it and open up a pull request. – tadman May 19 '19 at 01:09
  • 1
    Yeah I will docker/moby this thing up real soon –  May 19 '19 at 05:44
  • Possible duplicates: https://stackoverflow.com/a/51498679/596285 https://stackoverflow.com/a/51208726/596285 along with others. Did you [search for your error message](https://stackoverflow.com/search?q=%5Bdocker%5D+invalid+reference+format&mixed=0) before posting? Changing the message upstream would require changing all of these questions. – BMitch May 19 '19 at 15:12

1 Answers1

1

The problem was that the $ecr_endpoint variable was not defined. This took me more 15 minutes to figure out...awful error message hopefully it could be improved.

Before:

ecr_endpoint='' # empty

docker run --rm   \
    "$ecr_endpoint/notifier-cli:latest"                \
    --build-exit-code "$exit_code"                     \
    --event 'build-end'

I get the error :(

But now we define it:

ecr_endpoint='913xxxxx371.dkr.ecr.us-west-2.amazonaws.com' 

and it works

tadman
  • 208,517
  • 23
  • 234
  • 262