-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcaas.py
70 lines (66 loc) · 2 KB
/
caas.py
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
#!/usr/bin/python2
import commands
import cgi
print "content-type: text/html"
print
print "<marquee hspace=10 vspace=10 height=40><font> CONTAINER AS A SERVICE</font></marquee>"
print "<center>"
print "<h2>AVAILABLE DOCKER IMAGES</h2>"
print "<pre>"
print "<h4>"
print commands.getoutput("sudo docker images")
print "</h4>"
print "</pre>"
print "</center>"
print "<center>"
print "<form action='container.py'>"
print "<select name='image'>"
z=1
for i in commands.getoutput("sudo docker images").split('\n'):
if z==1 :
z+=1
pass
else:
j= i.split()
print "<option>" + j[0] + ":" + j[1] + "</option>"
print "</select>"
print "Your Container Name : <input name='cname' />"
print "<input type='submit' value='Start' />"
print "</form>"
print "<h3>Launch Multiple Containers</h3><br/>"
print "<form action='mcontainer.py'>"
print "<select name='image'>"
z=1
for i in commands.getoutput("sudo docker images").split('\n'):
if z==1 :
z+=1
pass
else:
j= i.split()
print "<option>" + j[0] + ":" + j[1] + "</option>"
print "</select>"
print """
Enter the Number : <input name='n' />
Unique Id: <input name='id' />
<input type='submit' value='start' />
"""
print "</form><br/>"
print """
<hr />
<center>
<h2> Create Your Own Image</h2>
<form action="dockerimage.py">
centos : <input name='os' value='centos' type='radio' /> ubuntu : <input name='os' value='ubuntu' type='radio' /> fedora : <input name='os' value='fedora' type='radio' />
<br/>
SSH Server : <input type='checkbox' name='ssh' value='ssh'/>
<br/>
Apache Server : <input type='checkbox' name='web' value='web' />
<br/>
Python2 : <input type='checkbox' name='python' value='python'/>
<br/>
Net-Tools : <input type='checkbox' name='ntool' value='ntool'/>
<br/>
Image Name: <input name="name" />
<input type='submit' value='Create Image'>
</center>
"""