Docker Community Forums

Share and learn in the Docker community.

Can't seem to mount file


#1

I’m trying to learn Docker to build a PHP/NGINX setup, following this tutorial. Unfortunately, when I try to mount the nginx.conf as directed, I get this error:

ERROR: for docker_nginx_1  Cannot start service nginx: OCI runtime create failed: container_linux.go:348: starting container process caused "process_linux.go:402: container init caused \"rootfs_linux.go:58: mounting \\\"/c/www/php_docker/docker/nginx/nginx.conf\\\" to rootfs \\\"/mnt/sda1/var/lib/docker/overlay2/8aa58bb7a5bb80ad62c173973ea3ab627bb5d6be53ecf70bed95221d28852c4c/merged\\\" at \\\"/mnt/sda1/var/lib/docker/overlay2/8aa58bb7a5bb80ad62c173973ea3ab627bb5d6be53ecf70bed95221d28852c4c/merged/etc/nginx/nginx.conf\\\" caused \\\"not a directory\\\"\"": unknown: 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

ERROR: for nginx  Cannot start service nginx: OCI runtime create failed: container_linux.go:348: starting container process caused "process_linux.go:402: container init caused \"rootfs_linux.go:58: mounting \\\"/c/www/php_docker/docker/nginx/nginx.conf\\\" to rootfs \\\"/mnt/sda1/var/lib/docker/overlay2/8aa58bb7a5bb80ad62c173973ea3ab627bb5d6be53ecf70bed95221d28852c4c/merged\\\" at \\\"/mnt/sda1/var/lib/docker/overlay2/8aa58bb7a5bb80ad62c173973ea3ab627bb5d6be53ecf70bed95221d28852c4c/merged/etc/nginx/nginx.conf\\\" caused \\\"not a directory\\\"\"": unknown: 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
ERROR: Encountered errors while bringing up the project.

I’m having trouble figuring out what’s wrong. Here’s my compose file:

version: '3'

services:
  php-fpm:
    build:
      context: ./php
    volumes:
      - ../src:/var/www

  nginx:
    build:
      context: ./nginx
    volumes:
      - ../src:/var/www
      - ./nginx/nginx.conf:/etc/nginx/nginx.conf
      - ./nginx/sites/:/etc/nginx/sites-available
      - ./nginx/conf.d/:/etc/nginx/conf.d
    depends_on:
      - php-fpm
    ports:
      - 80:80
      - 443:443

I’d love to get some help :confused: