Docker Community Forums

Share and learn in the Docker community.

Bind mounts with basic nginx configuration - not seeing container files in the host

I’m trying to set up a basic nginx reverse proxy following a tutorial from this site:


There the author writes the following: “It is VERY important that your config folder does NOT exist on your host first time you’re starting the container.”
This is the docker-compose.yml I’m using:

 version: '3'


 services:
    reverseproxy:
       container_name: reverse
       hostname: reverse
       image: nginx:1.15.12-alpine
       ports:
         - 80:80
         - 443:443
       volumes:
         - /binds/nginx/:/etc/nginx
         - /binds/ssl:/etc/ssl/private

Instead of seeing the normal configuration files from the container, I get the following error:

reverse         | 2019/05/10 11:33:44 [emerg] 1#1: open() "/etc/nginx/nginx.conf" failed (2: No such file or directory)
reverse         | nginx: [emerg] open() "/etc/nginx/nginx.conf" failed (2: No such file or directory)

So of course it’s trying to mount whatever there exists in /binds/nginx and /binds/ssl. But there is nothing there, and docker-compose itself actually creates directories. Should this normally work? Normally I’d have expected it to work the other way around, i.e. already having files on the hosts that I’d mount into the container and that the container would use.

Exact same issue - can’t seem to find any way around it.

I’m using Docker on a Synology NAS