Ran into this Docker error with one of my projects:
invalid reference format: repository name must be lowercase
What are the various causes for this generic message?
I already figured it out after some effort, so I'm going to answer my own question in order to document it here as the solution doesn't come up right away when doing a web search and also because this error message doesn't describe the direct problem Docker encounters.
had a space in the current working directory and usign
$(pwd)
to map volumes. Doesn't like spaces in directory names.On MacOS when your are working on an iCloud drive, your $PWD will contain a directory "Mobile Documents". It does not seem to like the space!
As a workaround, I copied my project to local drive where there is no space in the path to my project folder.
I do not see a way you can get around changnig the default path to iCloud which is
~/Library/Mobile Documents/com~apple~CloudDocs
The space in the path in "Mobile Documents" seems to be what docker run does not like.
Indeed, the docker registry as of today (sha
2e2f252f3c88679f1207d87d57c07af6819a1a17e22573bcef32804122d2f305
) does not handle paths containing upper-case characters. This is obviously a poor design choice, probably due to wanting to maintain compatible with certain operating systems that do not distinguish case at the file level (ie, windows).If one authenticates for a scope and tries to fetch a non-existing repository with all lowercase, the output is
However, if one tries to do this with an uppercase component, only 404 is returned:
This is happening because of the spaces in the current working directory that came from
$(pwd)
for map volumes. So, I useddocker-compose
instead.The
docker-compose.yml
file.Replacing
image: ${DOCKER_REGISTRY}notificationsapi
withimage:notificationsapi
orimage: ${docker_registry}notificationsapi
in docker-compose.yml did solves the issuefile with error
file without error
So i think error was due to non lower case letters it had
In my case, the image name defined in
docker-compose.yml
contained uppercase letters. The fact that the error message mentionedrepository
instead ofimage
did not help describe the problem and it took a while to figure out.