I followed the instructions here. https://www.digitalocean.com/community/tutorials/how-to-build-and-deploy-a-flask-application-using-docker-on-ubuntu-18-04 I’m trying to get my website to use NGINX and have a Docker Container serving my Flask Application. It is working, but it is on port 56733. I’m trying to have the Flask App served whenever anyone visits my web page. Could I just change the code below from start.sh
#!/bin/bash
app="docker.test"
docker build -t ${app} .
docker run -d -p **56733**:80 \
--name=${app} \
-v $PWD:/app ${app}
to
#!/bin/bash
app="docker.test"
docker build -t ${app} .
docker run -d -p **80**:80 \
--name=${app} \
-v $PWD:/app ${app}
I’m a noob at this and am doing this to learn more about Docker, Flask and NGINX. If anyone has any resources which explain NGINX well or deploying Docker on NGINX that would be greatly appreciated. I’ve been googling, but haven’t found the resources I’ve locate very helpful.
#!/bin/bash
app="docker.test"
docker build -t ${app} .
docker run -d -p **56733**:80 \
--name=${app} \
-v $PWD:/app ${app}
to
#!/bin/bash
app="docker.test"
docker build -t ${app} .
docker run -d -p **80**:80 \
--name=${app} \
-v $PWD:/app ${app}
I’m a noob at this and am doing this to learn more about Docker, Flask and NGINX. If anyone has any resources which explain NGINX well or deploying Docker on NGINX that would be greatly appreciated. I’ve been googling, but haven’t found the resources I’ve locate very helpful.
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.
Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.
Yes, it would work if you change the port from
56733
to80
, that way if you visit your IP or your page directly from the browser you would not have to specify a port after it, as port 80 would be bound on the host.However, I think that a better approach would be to use Nginx as a reverse proxy and pass the traffic from port
80
and port443
to the56733
port. You could follow the steps on how to configure Nginx for your docker here:https://www.thepolyglotdeveloper.com/2017/03/nginx-reverse-proxy-containerized-docker-applications/