docker-compose造成:您是否正在尝试将目录挂载到文件上(反之亦然)?

时间:2018-03-24 17:01:48

标签: docker nginx docker-compose

我有以下docker-compose.yml文件:

nginx:
    image: tutum/nginx
    ports:
        - "80:80"
    links:
        - phpfpm
    volumes:
        - ./nginx/default:/etc/nginx/sites-available/default
        - ./nginx/default:/etc/nginx/sites-enabled/default

        - ./logs/nginx-error.log:/var/log/nginx/error.log
        - ./logs/nginx-access.log:/var/log/nginx/access.log

phpfpm:
    build: ./mGSV
    ports:
        - "9000:9000"
    volumes:
        - ./public:/usr/share/nginx/html

mysql:
    image: mysql
    environment:
          - MYSQL_ROOT_PASSWORD=admin
          - MYSQL_DATABASE=mgsv
          - MYSQL_USER=mgsv_user
          - MYSQL_PASSWORD=mgsvpass
    ports:
          - "3306:3306"
    volumes:
          - ./mysql:/docker-entrypoint-initdb.d 

phpmyadmin:
  image: phpmyadmin/phpmyadmin
  restart: always
  links:
    - mysql
  ports:
    - 8183:80
  environment:
    PMA_USER: root
    PMA_PASSWORD: admin
    PMA_ARBITRARY: 1

我的mGSV/Dockerfile基于php:5-fpm容器,看起来像这样。

FROM php:5-fpm
...

docker-compose up --build期间,遗憾的是,我收到了以下错误:

Creating mgsvdocker2_nginx_1 ... error

ERROR: for mgsvdocker2_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 \\\"/home/mictadlo/projects/mGSV-docker2/nginx/default\\\" to rootfs \\\"/var/lib/docker/overlay2/2ffca193aad22856bb6c8e1262fc6c001fde8c5354009a366eeb6d9092d50b63/merged\\\" at \\\"/var/lib/docker/overlay2/2ffca193aad22856bb6c8e1262fc6c001fde8c5354009a366eeb6d9092d50b63/merged/etc/nginx/sites-enabled/default\\\" caused \\\"not a directory\\\"\""Creating mgsvdocker2_phpmyadmin_1 ... done

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 \\\"/home/mictadlo/projects/mGSV-docker2/nginx/default\\\" to rootfs \\\"/var/lib/docker/overlay2/2ffca193aad22856bb6c8e1262fc6c001fde8c5354009a366eeb6d9092d50b63/merged\\\" at \\\"/var/lib/docker/overlay2/2ffca193aad22856bb6c8e1262fc6c001fde8c5354009a366eeb6d9092d50b63/merged/etc/nginx/sites-enabled/default\\\" 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.

如何检查路径是否错误设置以及如何修复它的任何建议?

提前谢谢。

1 个答案:

答案 0 :(得分:0)

我在Windows上使用docker时看到了这个错误。以管理员身份运行终端,然后运行$ docker volume prune

您是否尝试过使用路径/ usr / local / nginx / sites-enabled?