I took the following steps on my system:
- I copied the code of your flash drive and the Dockerfile
- Created a requirements.txt file with
flask
in the first line - Built an image and ran it as you did.
It works great with me:
$ curl localhost:5000 Hello World!
The docker process does not work, and checking the logs is fine:
$ docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 0c0228a88719 flask-app "python app.py" 25 seconds ago Up 24 seconds 0.0.0.0:5000->5000/tcp frosty_borg $ docker logs 0c0228a88719 * Running on http://0.0.0.0:5000/ (Press CTRL+C to quit) * Restarting with stat * Debugger is active! * Debugger pin code: 216-035-222 172.17.0.1 - - [22/Jan/2017 12:56:37] "GET / HTTP/1.1" 200 -
When you start the docker container, check if it listens on port 5000. For example, on my system:
$ netstat -atn | grep 5000 tcp6 0 0 ::1.5000 *.* LISTEN tcp4 0 0 *.5000 *.* LISTEN $ docker stop 0c0228a88719 0c0228a88719 $ netstat -atn | grep 5000 $
The important thing is how you run dpcker, does it run on a Linux desktop machine? Or do you run it in a Linux virtual machine on a Mac / Windows host (through a service, such as a docker machine or other method)? If so, then the problem may be that the IP address you should be accessing is not localhost, but the IP address of the virtual machine.
source share