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
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.
Seems like you have an invalid name somewhere. Did you try to output pwd ?
Try to change the pwd with a static path.
Take a look at the documentation it might help you as well https://docs.docker.com/v1.10/engine/reference/commandline/run/#mount-volume-v-read-only
Your $(pwd) has characters that are not liked (e.g., spaces). Try using quotes around it:
docker run -d -p 9090:80 -v "$(pwd):/usr/share/nginx/html" nginx:alpine