Docker Community Forums

Share and learn in the Docker community.

Repository name lowercase error

I need to modify the prometheus.yml and I run the below command and it return a error: “docker: invalid reference format: repository name must be lowercase.”

docker run --name prometheus --rm -d -p 9090:9090 “$(pwd)/prometheus.yml”:etc/prometheus/prometheus.yml prom/prometheus

I tried many ways and I did`no have success. what’s wrong?

I’m using Mac.


This is wrong:

This should be correct:

docker run --name prometheus --rm -d -p 9090:9090 -v "$(pwd)/prometheus.yml":/etc/prometheus/prometheus.yml prom/prometheus
1 Like

All right… thanks a lot.

A “reference” in docker is a pointer to an image. It may be an image name, an image ID, include a registry server in the name, use a sha256 tag to pin the image, and anything else that can be used to point to the image you want to run.

The invalid reference format error message means docker cannot convert the string you’ve provided to an image. This may be an invalid name, or it may be from a parsing error earlier in the docker run command line if that’s how you run the image. With a compose file, if you expand a variable in the image name, that variable may not be expanding correctly.

With the docker run command line, this is often the result in not quoting parameters with spaces, and mistaking the order of the command line. The command line is ordered as:

docker {args_to_docker} run {args_to_run} image_ref ${cmd_to_exec}
The most common error in passing args to the run is a volume mapping expanding a path name that includes a space in it, and not quoting the path or escaping the space. E.g.

docker run -v $(pwd):/data image_ref
And the fix is as easy as:

docker run -v “$(pwd):/data” image_ref