Docker error: invalid reference format: repository name must be lowercase

前端 未结 22 1887
孤独总比滥情好
孤独总比滥情好 2020-12-12 23:07

Ran into this Docker error with one of my projects:

invalid reference format: repository name must be lowercase

What are the various causes for

相关标签:
22条回答
  • 2020-12-12 23:56

    In my case I had a naked --env switch, i.e. one without an actual variable name or value, e.g.:

    docker run \
       --env \       <----- This was the offending item
       --rm \
       --volume "/home/shared:/shared" "$(docker build . -q)"
    
    0 讨论(0)
  • 2020-12-12 23:57

    Replacing image: ${DOCKER_REGISTRY}notificationsapi with image:notificationsapi or image: ${docker_registry}notificationsapi in docker-compose.yml did solves the issue

    file with error

      version: '3.4'
    
    services:
      notifications.api:
        image: ${DOCKER_REGISTRY}notificationsapi
        build:
          context: .
          dockerfile: ../Notifications.Api/Dockerfile
    

    file without error

    version: '3.4'
    
    services:
     notifications.api:
        image: ${docker_registry}notificationsapi
        build:
          context: .
          dockerfile: ../Notifications.Api/Dockerfile
    

    So i think error was due to non lower case letters it had

    0 讨论(0)
  • Try to use lower case chars in your DockerFile

    For example, use:

    openjdk:8
    

    instead of

    openJDK:8
    
    0 讨论(0)
  • 2020-12-13 00:00

    In my case the problem was in parameters arrangement. Initially I had --name parameter after environment parameters and then volume and attach_dbs parameters, and image at the end of command like below.

    docker run -p 1433:1433 -e sa_password=myComplexPwd -e ACCEPT_EULA=Y --name sql1 -v c:/temp/:c:/temp/ attach_dbs="[{'dbName':'TestDb','dbFiles':['c:\\temp\\TestDb.mdf','c:\\temp\\TestDb_log.ldf']}]" -d microsoft/mssql-server-windows-express
    

    After rearranging the parameters like below everything worked fine (basically putting --name parameter followed by image name).

    docker run -d -p 1433:1433 -e sa_password=myComplexPwd -e ACCEPT_EULA=Y --name sql1 microsoft/mssql-server-windows-express -v C:/temp/:C:/temp/ attach_dbs="[{'dbName':'TestDb','dbFiles':['C:\\temp\\TestDb.mdf','C:\\temp\\TestDb_log.ldf']}]"
    
    0 讨论(0)
  • 2020-12-13 00:01

    A reference in Docker is what points to an image. This could be in a remote registry or the local registry. Let me describe the error message first and then show the solutions for this.

    invalid reference format

    This means that the reference we have used is not a valid format. This means, the reference (pointer) we have used to identify an image is invalid. Generally, this is followed by a description as follows. This will make the error much clearer.

    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. Simple troubleshooting steps.

    1) Dockerfile contains a capital letters as images.

    FROM Ubuntu (wrong)
    FROM ubuntu (correct)
    

    2) Image name defined in the docker-compose.yml had uppercase letters

    3) If you are using Jenkins or GoCD for deploying your docker container, please check the run command, whether the image name includes a capital letter.

    Please read this document written specifically for this error.

    0 讨论(0)
  • 2020-12-13 00:03

    In my case DockerFile contained the image name in mixed case instead of lower case.

    Earlier line in my DockerFile

    FROM CentOs
    

    and when I changed above to FROM centos, it worked smoothly.

    0 讨论(0)
提交回复
热议问题