-
Notifications
You must be signed in to change notification settings - Fork 57
/
Copy pathDocker_flask
89 lines (52 loc) · 1.49 KB
/
Docker_flask
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
Installing Docker
Prerequisites
1) Uninstall old versions:
sudo yum remove -y docker \
docker-client \
docker-client-latest \
docker-common \
docker-latest \
docker-latest-logrotate \
docker-logrotate \
docker-engine
2) Install Docker CE
Add the Utilities needed for Docker:
sudo yum install -y yum-utils \
device-mapper-persistent-data \
lvm2
3) Set up the stable repository:
sudo yum-config-manager \
--add-repo \
https://download.docker.com/linux/centos/docker-ce.repo
4) Install Docker CE:
sudo yum -y install docker-ce
5) Enable and start Docker:
sudo systemctl start docker && sudo systemctl enable docker
Add netsetostech2 to the docker group:
sudo usermod -aG docker netsetostech2
Installing a Flask Application on Debian based system
mkdir netsetostech
cd netsetostech
mkdir web
cd web
create a file app.py
from flask import Flask
app = Flask(__name__)
@app.route('/')
def hello_netsetos():
return "Netsetos, Hello there!"
if __name__ == '__main__':
app.run(debug=True, host='0.0.0.0')
Create a file requirements.txt
Flask==0.12
Create a Dockerfile
# Dockerfile - this is a comment. Delete me if you want.
FROM python:3.7
COPY . /app
WORKDIR /app
RUN pip install -r requirements.txt
ENTRYPOINT ["python"]
CMD ["app.py"]
Docker build command
docker build -t netsetos:latest .
docker run -d -p 5000:5000 netsetos