While mount a host folder with static content into a Docker Nginx container, I am getting the below error:
docker: Error response from daemon: invalid mode: usrsharenginxhtml.
I am running this command:
docker run --name website -v $(C:UsersUSERDesktopwebsite):usrsharenginxhtml -d -p 8080:80 nginx
2
Answers
Image in nginx is Linux based so location mapping is little different then windows, use :/usr/share/nginx/html/. It uses forward slash rather then backward slash.
Try
For the Windows path, use backslash and for the Linux path use forward slash. The
$(xxx)
notation you used is a Linux thing that takes the output of a command and puts it into the command. It’s often used with pwd where$(pwd)
gets the current directory. You can do the same in Windows CMD with%cd%
. In your case it would be