@@ -13,27 +13,24 @@ class Docker(object):
13
13
def start ():
14
14
if Settings .HOST_OS == OSType .WINDOWS :
15
15
docker = os .environ .get ("DOCKER_HOME" )
16
- if docker is not None :
17
- cmd = '"' + os .path .join (docker , 'Docker Desktop.exe' ) + '"'
18
- run (cmd = cmd , wait = False )
19
- Log .info ('Starting docker!' )
20
- else :
21
- cmd = r'"C:\Program Files\Docker\Docker\Docker Desktop.exe"'
16
+ if not Process .is_running_by_name ('Docker Desktop' ):
17
+ if docker is not None :
18
+ cmd = '"' + os .path .join (docker , 'Docker Desktop.exe' ) + '"'
19
+ run (cmd = cmd , wait = False )
20
+ Log .info ('Starting docker!' )
21
+ else :
22
+ cmd = r'"C:\Program Files\Docker\Docker\Docker Desktop.exe"'
23
+ run (cmd = cmd , wait = False )
24
+ Log .info ('Starting docker!' )
25
+ elif OSUtils .is_catalina ():
26
+ if not Process .is_running_by_name ('docker' ):
27
+ cmd = 'open --background -a Docker'
22
28
run (cmd = cmd , wait = False )
23
29
Log .info ('Starting docker!' )
24
- elif OSUtils .is_catalina ():
25
- cmd = 'open --background -a Docker'
26
- run (cmd = cmd , wait = False )
27
- Log .info ('Starting docker!' )
28
30
else :
29
31
Log .info ('No need to start docker!' )
30
32
31
33
@staticmethod
32
34
def stop ():
33
- if Settings .HOST_OS == OSType .WINDOWS :
34
- Process .kill ('Docker Desktop' )
35
- Process .kill ('Docker.Watchguard' )
36
- Process .kill ('com.docker.backend' )
37
- Process .kill ('com.docker.proxy' )
38
35
if OSUtils .is_catalina ():
39
36
Process .kill ('Docker' )
0 commit comments