-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdockerAuto.py
More file actions
101 lines (81 loc) · 2.73 KB
/
Copy pathdockerAuto.py
File metadata and controls
101 lines (81 loc) · 2.73 KB
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
90
91
92
93
94
95
96
97
98
99
100
101
import os
def main():
os.system("clear")
flag=1
while (flag==1) :
os.system("tput setaf 2")
print("\n\t\tThis menu is all about the Docker...")
os.system("tput setaf 1")
print("\t---------------------------------------------------")
os.system("tput setaf 3")
print("""
Enter 1 : To start the docker service
Enter 2 : To check the status of the docker service
Enter 3 : To know how many Images you have
Enter 4 : To Download the Image you want
Enter 5 : To Create the OS of any Image
Enter 6 : To Know how many Running OS
Enter 7 : To Know the List of OS you have
Enter 8 : To Start the Already Installed OS (Stopped/Run)
Enter 9 : If you want the stop any os
Enter 10 : To Exit from this menu..!!
""")
os.system("tput setaf 1")
print("\t---------------------------------------------------")
os.system("tput setaf 7")
ch = int(input("\nEnter Your Choice : "))
if (ch == 1):
os.system("systemctl start docker")
os.system("systemctl enable docker")
elif (ch == 2):
os.system("tput setaf 2")
print("Type Ctrl + c to exit from here..")
os.system("systemctl status docker")
elif (ch == 3):
os.system("tput setaf 6")
os.system("docker images")
elif (ch == 4):
os.system("tput setaf 2")
img = input("Enter Your image name which you want : ")
print("\nDownloading {} Image ...\n".format(img))
os.system("docker pull {}".format(img))
elif (ch == 5):
os.system("tput setaf 6")
name = input("Enter the name for os : \n ")
img = input("Enter Your image name for installation : \n")
version = input("Enter the Version of image : \n")
os.system("docker run -it --name {} {}:{}".format(name,img,version))
os.system("tput setaf 3")
elif (ch == 6):
os.system("tput setaf 2")
os.system("docker ps")
elif (ch == 7):
os.system("tput setaf 5")
os.system("docker ps -a ")
elif (ch == 8):
os.system("tput setaf 2")
name = input("Enter the name of os which you want to start :\n")
os.system("docker start {}".format(name))
os.system("docker attach {}".format(name))
os.system("tput setaf 6")
elif (ch == 9):
os.system("tput setaf 6")
name = input("Enter the name of os which you want to stop.. ")
os.system("docker stop {}".format(name))
elif (ch == 10):
os.system("tput setaf 2")
print("Closing This Automation!!")
os.system("tput setaf 7")
flag=0
else :
os.system("tput setaf 1")
print("Option Not Supported")
os.system("tput setaf 6")
x = input("\nPress Enter To Continue:\n ")
os.system("tput setaf 7")
if (x==""):
os.system("clear")
else:
flag=0
if __name__=='__main__':
main()