Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Next »

Python Flask applications can be deployed into Docker container but there a few steps you need to follow carefully

  1. Create a folder
  2. Place into this folder all your python code.
  3. Place into this folder a Dockerfile file (to be described below)
  4. Place in the folder a requirements.txt file (to be described below)
  5. build the Dockerfile 
    1. command: docker build -t <new image name>:<tag> .
    2. e.g. docker build -t flask-sample-server:latest .
  6. now run your image
    1. docker run -it -p <host port>:<container port> --name <host name> <new image name>:<tag>
    2. docker run -it -p 5002:5000 --name pyt flask-sample-server

Dockerfile


requirements.txt



  • No labels