Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

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

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>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
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading