docker run
throws an "invalid reference format: repository name must be lowercase" error when using $(pwd)
in the volume flag (-v
). This is the command that is currently causing the issue:
docker run --rm -v $(pwd)/app/polymer:/home/polymer/app jefferyb/polymer-cli polymer build
How to fix - docker: invalid reference format: repository name must be lowercase? The simplest way to fix the issue by change the image to jhooq-docker-demo so that there is no uppercase character in the image name .
To run an image inside of a container, we use the docker run command. The docker run command requires one parameter and that is the image name. Let's start our image and make sure it is running correctly.
The --rm causes Docker to automatically remove the container when it exits. The image being used to create the container is generally specified as <name>:<tag> such as ruby:latest . If the specified image is not available locally, Docker will attempt to retrieve it from Docker Hub (or any connected Docker registry).
invalid reference format: repository name must be lowercase This means the reference we are using should not have uppercase letters. Try running docker run Ubuntu (wrong) vs docker run ubuntu (correct). Docker does not allow any uppercase characters as an image reference.
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.
docker run throws an "invalid reference format: repository name must be lowercase" error when using $ (pwd) in the volume flag ( -v ). This is the command that is currently causing the issue: FYI, $ (pwd) is extremely inefficient compared to "$PWD".
Basically a reference in docker is a pointer to image, so whenever you use image name inside your Dockerfile or docker command it get parsed and the image name should follow certain rules as described in below in the table of content -
For my own circumstance, the output of pwd
contained a directory with a space (i.e. /something/Problematic Directory/something-else). This was resolved by wrapping $(pwd)
in quotation marks to explicitly identify it as a string:
docker run --rm -v "$(pwd)/app/polymer":/home/polymer/app jefferyb/polymer-cli polymer build
The documentation I read didn't use quotation marks, however this might be better practise when using variable interpolation in shell to avoid these kind of issues.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With