I am new to docker and would really appretiate any help on this. I am running an python flask application in a docker container.
I am using the below command to run the docker image:
docker container run -d -p 5000:8051 rep1/doc-image:0.0.1.RELEASE
Below is my docker Logs which show my flask app running
2023-07-18 20:07:18 Dash is running on http://127.0.0.1:8051/
2023-07-18 20:07:18
2023-07-18 20:07:18 * Serving Flask app 'main'
2023-07-18 20:07:18 * Debug mode: off
2023-07-18 20:07:18 WARNING: This is a development server. Do not use it in a production deployment. Use a production WSGI server instead.
2023-07-18 20:07:18 * Running on http://127.0.0.1:8051
2023-07-18 20:07:18 Press CTRL+C to quit
Below is my dockerfile
FROM tiangolo/uwsgi-nginx-flask:python3.8
WORKDIR /app
COPY . /app
RUN pip install -r requirements.txt
EXPOSE 8051
CMD [ "python","./main.py" ]
I can see that port 5000 is being properly mapped to port 8051 from the output of docker ps
command
0.0.0.0:5000->8051/tcp
But still on running localhost:5000
, I am getting the error:
This page isn’t working Localhost didn’t send any data
I tried specifing the host address when running the command for running docker image, incase the host address in docker is different than localhost, but I am again getting the same error.
docker container run -d -h localhost -p 5000:8051 rep1/doc-image:0.0.1.RELEASE