DEV Community

Discussion on: Nginx as reverse proxy for a flask app using Docker

Collapse
 
codesytex profile image
CodeSytex

Hello,

I follow your example and when I start the docker-compose at the end of your guide (with the configuration of the proxy pass) I have the error :

2020/03/04 15:33:50 [emerg] 1#1: host not found in upstream "flask-app" in /etc/nginx/conf.d/default.conf:6

nginx: [emerg] host not found in upstream "flask-app" in /etc/nginx/conf.d/default.conf:6

I checked and all my files are like your example.

Any ideas ??

Thanks !

Collapse
 
ishankhare07 profile image
Ishan Khare • Edited

Also did you forget adding alias?

networks:
    my-network:
        aliases:
            - flask-app
Collapse
 
ishankhare07 profile image
Ishan Khare

Can I look at your sample code, is available in some repo?

Collapse
 
ishankhare07 profile image
Ishan Khare

As I mention in point 4

The proxy_pass directive takes as argument the url to which we are proxying. In our case we will alias our flask container in the docker network as flask-app. This makes our flask app accessible at flask-app:5000/ from inside the nginx container.