Docker Daemon is not able to create nginx config file

35 Views Asked by At

Background:

  1. Running Linux Containers on Docker
  2. Using WSL2
  3. Running a flask app on Docker - succeeded
  4. Built a nginx config file and that fails while doing docker-compose

nginx.config file is as follows:

events {
    worker_connections 1000;
}

http {
    server {
        listen 80;

        location / {
            proxy_pass http://app:5000
        }
    }
}

docker-compose yml is as follows:

version: '3'

services:
    app:
        build:
            context: app
        ports:
            - "5000"
    
    nginx:
        image: nginx:latest
        volumes:
            - ./nginx.conf:/etc/nginx/nginx.conf:ro
        depends_on:
            - app
        ports:
            - "80:80"
        

while executing this: docker-compose up -d --build --scale app=3

My error is: Error response from daemon: CreateFile pathspecified\nginx.conf: Access is denied.

I researched and it said WSL2 automatically shares all files from windows, so I am not able to get why this error comes after I create nginx.config? How can I fix this?

0

There are 0 best solutions below