Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Docker Compose host path error with nginx

I've a error when I run docker-compose up nginx with my host path :

ERROR: for nginx Cannot start service nginx: oci runtime error: container_linux.go:247: starting container process caused "process_linux.go:359: container init caused \"rootfs_linux.go:54: mounting \\"/d/Sites/lfdwveille/app/config/docker/nginx.conf\\" to rootfs \\"/mnt/sda1/var/lib/docker/aufs/mnt/fce42187ef3ff6bcc0d5acf53a77d2218348a432063e2d5fe00b8ac945578f63\\" at \\"/mnt/sda1/var/lib/docker/aufs/mnt/fce42187ef3ff6bcc0d5acf53a77d2218348a432063e2d5fe00b8ac945578f63/etc/nginx/nginx.conf\\" caused \\"not a directory\\"\""

: Are you trying to mount a directory onto a file (or vice-versa)? Check if the specified host path exists and is the expected type

[31mERROR[0m: Encountered errors while bringing up the project.

The folder url is correct :( I don't know why nginx don't want mount folder and I've no problem with PHP and MySQL.

My setup :

  • Windows
  • docker-compose v1.9.0
  • docker 1.12

Error log :

container_linux.go:247: starting container process caused "process_linux.go:359: container init caused \"rootfs_linux.go:54: mounting \\"/d/Sites/lfdwveille/app/config/docker/nginx.conf\\" to rootfs \\"/mnt/sda1/var/lib/docker/aufs/mnt/fce42187ef3ff6bcc0d5acf53a77d2218348a432063e2d5fe00b8ac945578f63\\" at \\"/mnt/sda1/var/lib/docker/aufs/mnt/fce42187ef3ff6bcc0d5acf53a77d2218348a432063e2d5fe00b8ac945578f63/etc/nginx/nginx.conf\\" caused \\"not a directory\\"\""

Anyone have idea ?

Thank you !

like image 407
s-leg3ndz Avatar asked Feb 02 '17 15:02

s-leg3ndz


People also ask

Where is nginx config file Docker?

Maintaining Content and Configuration Files on the Docker Host. Any change made to the files in the local directories /var/www and /var/nginx/conf on the Docker host are reflected in the directories /usr/share/nginx/html and /etc/nginx in the container.

What is nginx reverse proxy Docker?

Nginx and Docker reverse proxy configurationA reverse proxy handles client requests, and then forwards those requests to another server that runs in the backend. This backend origin server processes the request and provides a response back to Nginx, which then sends the response back to the client.

Should nginx run inside Docker?

If nginx is running in a container then your site is going to be 100% dead to the world while Docker isn't running. Users will get a connection error. When nginx is installed directly on your host you can serve a 503 maintenance page that doesn't depend on Docker or any containers running.


1 Answers

If you are using Docker Machine on Windows, docker has limited access to your Windows filesystem. By default Docker Machine tries to auto-share your C:\Users (Windows) directory.

Docker compose - share volume Nginx

like image 72
rofrol Avatar answered Oct 06 '22 16:10

rofrol