Docker-Flask

#python code

touch hello.py
vim hello.py

#!/usr/bin/env python

from flask import Flask
a[[ = Flask(__name__)
@app.route('/hi')
def hell_world():
    return "Hello world"

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


touch Dockerfile
vim Dockerfile

FROM ubuntu:14.04

RUN apt update
RUN apt install -y python
RUN apt install -y python-pip
RUN apt clean all

RUN pip install flask
ADD hello.py /tmp/hello.py

EXPOSE 5000
CMD ["python", "/tmp/hello.py"]


docker build -t flask .

docker images

docker run -d -P flask

docker ps -a

dockr run -t -i -P flask /bin/bash

#####
touch Dockerfile
vim Dockerfile

FROM ubuntu:14.04
RUN apt update && apt install -y python python-pip

RUN pip install flask

ADD hello.py /tmp/hello.py

#####
FROM python:2.7.10

RUN pip install flask
COPY hello.py /tmp/hello.py


docker images
dicjer tag ubuntu:14.04 foobar
docker images
docker tag ubuntu:14.04 foobar:cookbook

docker tag -h