Search code examples
dockercommand-linewindows-subsystem-for-linux

I am trying to access a file and I am getting the `docker: invalid reference format: repository name must be lowercase`. error. Any adivce?


I am completely new to linux and docker so please be patient and will greatly apreciate an easy to understand anwser. I am following this guide: https://degauss.org/using_degauss.html and I am at the section where it states Using the DeGAUSS Geocoder. I have set my working directory and I am trying to run docker run --rm -v $PWD:/tmp degauss/geocoder:3.2.1 filtered_file.csv(changed the name for this example as well as the version of geocoder). However when I type that into ubuntu linux subsystem 22.04.1, I get the following error: docker: invalid reference format: repository name must be lowercase. I am not sure what this means. I changed my working directory using cd /mnt/c/Users/Name/Desktop/"FOLDER ONE"/"Folder 0002"/"Here"/. What should I do to fix this issue?

(pwd shows me that the working directory is /mnt/c/Users/Name/Desktop/FOLDER ONE/Folder 0002/Here/

Thanks in advance for your help.

I am expecting the geocoder to run, I have docker open in the background. All I have been able to do is type in docker run --rm -v $PWD:/tmp degauss/geocoder:3.2.1 filtered_file.csv and it is not wokring as noted with the error docker: invalid reference format: repository name must be lowercase.The latest version of geocoder is 3.2.1


Solution

  • You need to put the variable reference $PWD in double quotes. This is generally good practice when using the Unix Bourne shell and I'd recommend always doing it.

    docker run --rm -v "$PWD:/tmp" ...
    #                  ^         ^
    

    What's happening here is that the shell first expands the variable reference, then splits the command into words. So you get

    docker run --rm -v /mnt/.../FOLDER ONE/Folder 0002/Here/:/tmp ...
    
    docker run --rm \
      -v /mnt/.../FOLDER \  # create anonymous volume on this container directory
      ONE/Folder         \  # image name
      0002/Here/:/tmp ...   # main container command
    

    The double quotes avoid the word splitting, and you very rarely actually want it.