Creating docker containers is a great way to separate your projects and quick to publish and others test the program
create a new python program to run a Flask app
@app.route("/")
def main(): return "Welcome to Docker images running on windows"
@app.route('/how are you')
def hello(): return 'I am good, how about you?'
if name == "main": app.run(host="0.0.0.0")
FROM ubuntu
RUN apt-get update && apt-get -y install python
RUN apt-get install python3-pip -y
RUN pip install flask flask-mysql
COPY . /opt
EXPOSE 5000
CMD ["python3", "/opt/app.py"]
On Docker Hub create free account to pubish your containers.
docker build . -f dockerfile -t mcs4uweb/my-app
Install the docker CLI to manage your containers and images.
google docker cli
docker images
docker run -p 5000:5000 70c9404d25b6
find your IP address and open the browser
use ifconfig to find your ip address
ipconfig
Windows IP Configuration IPv4 Address. . . . . . . . . . . : 192.168.1.152
in the browser
192.168.1.152:5000