Unable to connect to docker flash application from host

I installed the docker ubuntu 14.04 image and I run it with the following command:

docker run -d -p 5000:5000 ari/python3-flask

Docker File:

FROM ubuntu:14.04
RUN apt-get update && apt-get install -y python3 python3-pip
ADD . /var/my_app
RUN pip3 install -r /var/my_app/requirements.txt
EXPOSE 5000
CMD ["python3", "/var/my_app/runserver.py"]

However, if I try to twist the address (localhost: 5000) or visit it in a browser, I get an error with a connection error.

The docker log for the container shows:

Running on http://127.0.0.1:5000/

Restarting with reloader

Does anyone know what could be or something is wrong with my setup and / or docker configuration? Thank.

+4
source share
1 answer

The web server running in your container listens for connections on port 5000 of the loopback ( 127.0.0.1) network interface . Thus, this web server will only respond to HTTP requests coming from this container.

- , , IP- 0.0.0.0.

Flask, runerver.py, :

if __name__ == '__main__':
    app.run(host='0.0.0.0')

, , - :

 * Running on http://0.0.0.0:5000/
+26

All Articles