I try create docker container container with nginx. (Windows 10 64 bit)
site:
image: nginx:stable-alpine
container_name: nginx
ports:
- "8080:80"
volumes:
- ./src:/var/www/html
- ./nginx/default.conf:/etc/nginx/conf.d/default.conf
depends_on:
- php
- mysql
networks:
- laravel
And got error:
ERROR: for site Cannot start service site: OCI runtime create failed: container_linux.go:344: starting container process caused "process_linux.go:424: container init caused \"rootfs_linux.go:58: mounting \\\"/host_mnt/e/laravel-docker-new/docker-compose-laravel/nginx
/default.conf\\\" to rootfs \\\"/var/lib/docker/overlay2/cc15f98e2704e4be5aa3d26ab7a216f3c301ebfcf678c951c2ae5aefad0f794a/merged\\\" at \\\"/var/lib/docker/overlay2/cc15f98e2704e4be5aa3d26ab7a216f3c301ebfcf678c951c2ae5aefad0f794a/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
How fix this?
Update.
Try conf
site:
image: nginx:stable-alpine
container_name: nginx
ports:
- "8080:80"
volumes:
- ./src:/var/www/html/public
./nginx/default.conf COPY /etc/nginx/conf.d/default.conf
depends_on:
- php
- mysql
networks:
- laravel
But how use artisan?
artisan: build: context: . dockerfile: php.dockerfile container_name: artisan volumes: - ./src:/var/www/html/public depends_on: - mysql working_dir: /var/www/html/public entrypoint: [ '/var/www/html/public/artisan'] networks: - laravel
And how I can got access to laravel?
Files structure
E:/laravel-docker-new/docker-compose-laravel
.github
nginx
nginx/default.conf
src
src/app
src/bootstrap
src/config
src/database
src/public
src/resources
src/routes
src/storage
src/test
src/tests
src/vendor
src/.editorconfig
src/.env
src/.env.example
src/.gitattributes
src/.gitignore
src/.styleci.yml
src/composer.phar