docker: Error response from daemon: invalid mode: \usr\share\nginx\html\

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: \usr\share\nginx\html\.

I am running this command:

docker run --name website -v $(C:\Users\USER\Desktop\website):\usr\share\nginx\html\ -d -p 8080:80 nginx

>Solution :

Try

docker run --name website -v C:\Users\USER\Desktop\website:/usr/share/nginx/html -d -p 8080:80 nginx

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. Usually 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

docker run --name website -v %cd%:/usr/share/nginx/html -d -p 8080:80 nginx

Leave a Reply