I'm working on nginx service using docker-compose, I created the docker-compose.yml file :
version: '2'
services:
nginx:
image: nginx:1.11.8-alpine
ports:
- "8858:80"
volumes:
- ./site.conf:/etc/nginx/conf.d/default.conf
- ./code:/usr/share/nginx/html
- ./html:/myapp
- ./site.conf:/etc/nginx/conf.d/site.conf
- ./error.log:/var/log/nginx/error.log
- ./nginx.conf:/etc/nginx/nginx.conf:ro
This is the site.conf file
server {
listen 80;
index index.html index.php;
server_name localhost;
error_log /var/log/nginx/error.log;
location / {
root /usr/share/nginx/html;
}
location /html {
alias /myapp;
}
}
This is the result of docker-compose up
ERROR: for ef5152b88a7c_ef5152b88a7c_nginxdocker_nginx_1 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 \\"/root/nginx-docker/nginx.conf\\" to rootfs \\"/var/lib/docker/aufs/mnt/b463f0e0ca95db8cd570dfb68fcf206df31e86998e725465a7673ca192af8342\\" at \\"/var/lib/docker/aufs/mnt/b463f0e0ca95db8cd570dfb68fcf206df31e86998e725465a7673ca192af8342/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
nginx.conf
exists in the host folder? – Stefano