Python Flask applications can be deployed into Docker container but there a few steps you need to follow carefully
- Create a folder
- Place into this folder all your python code.
- Place into this folder a Dockerfile file (to be described below)
- Place in the folder a requirements.txt file (to be described below)
- build the Dockerfile
- command: docker build -t <new image name>:<tag> .
- e.g. docker build -t flask-sample-server:latest .
- now run your image
- docker run -it -p <host port>:<container port> --name <host name> <new image name>:<tag>
- docker run -it -p 5002:5000 --name pyt flask-sample-server