简体   繁体   中英

I am trying to configure nginx as proxy server but getting an error while composing docker file

I am trying to configure nginx as proxy server but getting an error. I have created below file as part of my work.

DockerFile

 FROM nginx:1.10.1-alpine
 RUN rm /etc/nginx/conf.d/*
 COPY proxy.conf /etc/nginx/conf.d/

Proxy.config

server {

listen 80;

location / {
    proxy_pass http://app;

}
}

docker-compose.yml


version: '2'

services:
app:
    build: app

proxy:
    build: proxy
    ports:
      - "80:80"

When I build docker-compose file I am getting following error:

Puja:Docker pujadudhat$ docker-compose build
Building app
Step 1/2 : FROM nginx:1.10.1-alpine
---> 2cd900f340dd

Step 2/2 : COPY index.html /usr/share/nginx/html
---> Using cache
---> 9d105a18fb9d
Successfully built 9d105a18fb9d
Building proxy

Step 1/3 : FROM nginx:1.10.1-alpine
---> 2cd900f340dd  
Step 2/3 : RUN rm /etc/nginx/conf.d/*
---> Using cache
---> a4e1efc3f050
Step 3/3 : COPY proxy.conf /etc/nginx/conf.d/
ERROR: Service 'proxy' failed to build: lstat proxy.conf: no such file or directory

I am getting this error "Service 'proxy' failed to build: lstat proxy.conf: no such file or directory. Can anyone help me to solve? Thank you.n

Looks like you are missing the proxy.conf in your project where you build the docker container. It looks like you have it named Proxy.conf and it should be named proxy.conf .

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM