我正在尝试构建一个docker镜像,每次运行
Docker Compose Up
它将我的ngnix.conf文件更改为目录并抛出此错误;
ERROR: for ngnixdocker_web_1 Cannot start service web: OCI runtime create failed: container_linux.go:296: starting container process caused "process_linux.go:398: container init caused \"rootfs_linux.go:58: mounting \\\"/Users/andrew/Desktop/ngnixdocker/.nginx.conf\\\" to rootfs \\\"/var/lib/docker/overlay2/4d2ee251b41131ad9802152f801aee7d79cdf6d0c9debeabcc2e5e40fb7c64cb/merged\\\" at \\\"/var/lib/docker/overlay2/4d2ee251b41131ad9802152f801aee7d79cdf6d0c9debeabcc2e5e40fb7c64cb/merged/etc/nginx/conf.d/default.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 web Cannot start service web: OCI runtime create failed: container_linux.go:296: starting container process caused "process_linux.go:398: container init caused \"rootfs_linux.go:58: mounting \\\"/Users/andrew/Desktop/ngnixdocker/.nginx.conf\\\" to rootfs \\\"/var/lib/docker/overlay2/4d2ee251b41131ad9802152f801aee7d79cdf6d0c9debeabcc2e5e40fb7c64cb/merged\\\" at \\\"/var/lib/docker/overlay2/4d2ee251b41131ad9802152f801aee7d79cdf6d0c9debeabcc2e5e40fb7c64cb/merged/etc/nginx/conf.d/default.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
这是我的docker compose.yml
web:
image: nginx:latest
ports:
- "8080:80"
volumes:
- ./code:/code
- ./nginx.conf:/etc/nginx/conf.d/default.conf
links:
- php