Today i got new error in my docker-environment. I just started my project (Web, Php and Postgres Containers), but Nginx container dont started, because the site.conf, which i mount with volumes is a "directory".
Last friday it was ok and worked nice for me. I dont change anything in this case. ;(
I created extra docker-compose file, where you can try to reproduce my error.
docker-compose File:
version: "3"
services:
nginx:
container_name: nginxCr
image: nginx:1.15.7
ports:
- "80:80"
volumes:
- .:/var/www
- ./site.conf:/etc/nginx/conf.d/site.conf
site.conf can be empty for testing.
after docker-compose up -d Container is not running.
docker logs nginxCr provides following:
2019/03/04 14:49:25 [crit] 1#1: pread() "/etc/nginx/conf.d/site.conf" failed (21: Is a directory) nginx: [crit] pread() "/etc/nginx/conf.d/site.conf" failed (21: Is a directory)
Somehow start the docker (docker compose) to creating directory instead of linking my config file.
I have Windows 10 Pro (Build 17134)
Docker version 18.09.2, build 6247962
docker-compose version 1.23.2, build 1110ad01
UPDATE: Problem seems to be Windows only... on my Nix-Server it works fine
the solution was to uncheck -> apply
and then
check -> apply
the Harddrive in "Shared Drivers" in Docker-Settings
*facepalm*
Keep your www
files in a sperate folder instead of .
. Have a compose file like below:
services:
nginx:
container_name: nginxCr
image: nginx:1.15.7
ports:
- "80:80"
volumes:
- ./www:/var/www
- ./site.conf:/etc/nginx/conf.d/site.conf
So, in your Present working Dir you should have a folder called www
(so that you don't have to merge volumes) and a file called site.conf
. Even if it is an empty file, you should have it in your directory. Otherwise, docker
will create a folder in that name.
In case if you have a folder called site.conf
, delete that folder and do touch site.conf
, then do docker-compose up -d
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.