Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

592
Vistas
Unable to connect to flask while running on docker container

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.

docker-compose file

version: '3'
services:
  web:
    build: .
    ports:
     - "5000:5000"
    volumes:
      - .:/app
    environment:
      FLASK_APP: api
      FLASK_ENV: development

  redis:
    image: "redis:alpine"

dockerfile

FROM python:3.7

ADD . /app
WORKDIR /app

RUN pip install -r requirements.txt
CMD ["flask", "run"]

__init__py:

def create_app(test_config=None):
  app = Flask(__name__, instance_relative_config=True)
  ...

  return app

result from docker-compose up --build

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

enter image description here

Any ideas why? I can't see what I am missing because the server is running but it does reset the connection right away...

Edit:

  • I did try to access it via localhost, 0.0.0.0, also using the container IP address
over 4 years ago · Santiago Trujillo
1 Respuestas
Responde la pregunta

0

Try

CMD ["flask", "run", "--host=0.0.0.0"]
over 4 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda