Reputation: 19
folks i have a web folder which has the following files inside: app.py Docker file requirements.txt outside that file i have a docker-compose.yml
the code is as follows: app.py
code...
if __name__ == "__main__":
app.run(host='0.0.0.0')
on the requirements txt:
Flask
flask_restful
on the DockerFile:
FROM python:3
WORKDIR /usr/src/app
COPY requirements.txt ./
RUN pip install --no-cache-dir -r requirements.txt
COPY . .
CMD [ "python", "./app.py" ]
and on the docker-compose.yml:
version: '3'
services:
web:
build: ./web
ports:
- "5000:5000"
i go on the terminal and i run docker compose build and docker compose up
and server runs as below:
se 'docker scan' to run Snyk tests against images to find vulnerabilities and learn how to fix them
PS C:\Users\sarandis\Desktop\Python API\web service> docker compose up
webservice-web-1 | * Serving Flask app 'app' (lazy loading)
webservice-web-1 | * Environment: production 0.6s
webservice-web-1 | WARNING: This is a development server.
Do not use it in a production deployment.
webservice-web-1 | Use a production WSGI server instead.
webservice-web-1 | * Debug mode: off Do not use it in a production deployment.
webservice-web-1 | * Running on all addresses.
webservice-web-1 | WARNING: This is a development server.
Do not use it in a production deployment.
webservice-web-1 | * Running on http://172.18.0.2:5000/ (PreDo not use it in a production deployment.ss CTRL+C to quit) ss CTRL+C to quit)
Gracefully stopping...
the problem i have when i click on the url it provides me it says that the site cant be reached!! why is that? what em i doing wrong?
note that when i do flask run the app runs at it should and all the get and post requests work fine!
Thank you in advance
Upvotes: 0
Views: 150
Reputation: 4529
Have you tried to access http://localhost:5000 instead of the provided URL?
Upvotes: 2