Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Docker command returns "invalid reference format"

Tags:

docker

I'am using docker and using the following command:

docker run -d -p 9090:80 -v $(pwd):/usr/share/nginx/html nginx:alpine 

to point to my /dist folder where my app-files are compiled by angular.

I first go to /dist folder and then run the command from there. This was working fine and I was able to reach the app via port: 9090, but after docker update, I run in error:

docker: invalid reference format. See 'docker run --help'.

I have been searching and checked the following posting docker : invalid reference format, but it seems to be different to my issue. Here is the info based on the command: docker version:

Client:  Version:      17.09.0-ce  API version:  1.32  Go version:   go1.8.3  Git commit:   afdb6d4  Built:        Tue Sep 26 22:40:09 2017  OS/Arch:      darwin/amd64  Server:  Version:      17.09.0-ce  API version:  1.32 (minimum version 1.12)  Go version:   go1.8.3  Git commit:   afdb6d4  Built:        Tue Sep 26 22:45:38 2017  OS/Arch:      linux/amd64  Experimental: false 

Any idea please?

like image 395
k.vincent Avatar asked Nov 22 '17 13:11

k.vincent


People also ask

What is docker invalid reference format?

"docker: invalid reference format" messageThe current directory ( %CD% ) or user profile path ( %USERPROFILE% ) in the command contains a space. To fix the problem, put double quotation marks around any references to a path that contains one or more spaces.

What is docker format?

Docker format is used to manipulate the output format of commands and log drivers that have the '–format' option, which means if a command has the '–format' option, then we can use that option to change the output format of the command as per our requirement because default command does not shows all the fields related ...

How do I tag a docker image?

Docker tags are just an alias for an image ID. The tag's name must be an ASCII character string and may include lowercase and uppercase letters, digits, underscores, periods, and dashes. In addition, the tag names must not begin with a period or a dash, and they can only contain 128 characters.


1 Answers

Docker is seeing something unexpected before the image name, making it think something in your command other than the nginx:alpine is your image name. This may be an invalid - before each of your options, often seen with a copy/paste from the web. It may also be a space in your path. If it's as simple as a space in your path, then quoting it will resolve that:

docker run -d -p 9090:80 -v "$(pwd):/usr/share/nginx/html" nginx:alpine 

If the above two do not resolve your issue, first make sure the following works:

docker run nginx:alpine 

And then add individual parameters back into your command until you find the one that breaks it. Pay special attention to the order of your args, parameters to run must be between the run and your image name. Args after the image name are passed as a command to run. Args before the run are options to the docker top level command.

like image 184
BMitch Avatar answered Oct 26 '22 08:10

BMitch