I am trying to use nginx on my docker server, but when creating a volume pointing to /etc/nginx
, nginx fails to launch and the volume ends up being empty.
Here is my docker-compose.yml:
version: '3'
services:
nginx:
image: nginx:1.15-alpine
container_name: nginx-1
ports:
- "80:80"
- "443:443"
volumes:
- ./www:/var/www
- ./container/nginx/conf:/etc/nginx
Upon running docker-compose up
...
nginx-1 | nginx: [emerg] open() "/etc/nginx/nginx.conf" failed (2: No such file or directory)
nginx-1 exited with code 1
If I remove - ./container/nginx/conf:/etc/nginx
from the docker-compose.yml, it boots up fine, but uses the default config.
This happens on both nginx:1.15-alpine
and nginx:latest
.
What am I doing wrong? Thanks for your answers in advance!