I am trying to move a simple flask application to docker, but I can't see to figure out why the application is not accessible from the browser.
version: '3'
services:
  web:
    build: .
    ports:
     - "5000:5000"
    volumes:
      - .:/app
    environment:
      FLASK_APP: api
      FLASK_ENV: development
  redis:
    image: "redis:alpine"
FROM python:3.7
ADD . /app
WORKDIR /app
RUN pip install -r requirements.txt
CMD ["flask", "run"]
def create_app(test_config=None):
  app = Flask(__name__, instance_relative_config=True)
  ...
  return app
web_1    |  * Serving Flask app "api" (lazy loading)
web_1    |  * Environment: development
web_1    |  * Debug mode: on
web_1    |  * Running on http://127.0.0.1:5000/ (Press CTRL+C to quit)
web_1    |  * Restarting with stat
web_1    |  * Debugger is active!
web_1    |  * Debugger PIN: 277-205-758
But when I got to the browser:
The connection was reset

Any ideas why? I can't see what I am missing because the server is running but it does reset the connection right away...
Try
CMD ["flask", "run", "--host=0.0.0.0"]
                        If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With