Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

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?

question from:https://stackoverflow.com/questions/47435418/docker-command-returns-invalid-reference-format

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
397 views
Welcome To Ask or Share your Answers For Others

1 Answer

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...