when a run a simple flask application with a specified port(5888) from the console it is running well and is provided with a URL: * Debugger PIN: 125-876-281 * Running on http://127.0.0.1:5888/ (Press CTRL+C to quit)
for the same application when I build a docker image and run using the comman : docker run -p 192.168.0.152:5888:5888 dock_test is is giving the URL : *** Running on all addresses (0.0.0.0) * Running on http://127.0.0.1:5000 * Running on http://172.17.0.3:5000** with the different port(5000).
The main python file: app.py
from flask import Flask
app = Flask(__name__)
@app.route("/")
def index():
return "running"
if __name__ == "__main__":
app.run(debug=True,port=5888)
docker file: Dockerfile
FROM ubuntu
RUN apt update
RUN apt install python3-pip -y
RUN pip3 install Flask
COPY requirements.txt requirements.txt
ENV LISTEN_PORT=5888
EXPOSE 5888
RUN pip3 install -r requirements.txt
WORKDIR C:\Users\heman\PycharmProjects\dock_test\main.py
COPY . .
ENV FLASK_APP=main.py
CMD ["python3","-m","flask","run","--host=0.0.0.0"]
Step-1: To build the image I've run : docker build -t dock_test .(it created the docker image well)
step-2: To run : docker run -d -p 5888:5888 dock_test output: * Running on all addresses (0.0.0.0) * Running on http://127.0.0.1:5000 * Running on http://172.17.0.3:5000 why the port is changing to 5000 instead of 5888?