Skip to content

Commit 682b45a

Browse files
committed
refactor: Improve Docker network connection command in StartService.php
1 parent d44e3a1 commit 682b45a

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

app/Actions/Service/StartService.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ public function handle(Service $service)
1616
$service->saveComposeConfigs();
1717
$commands[] = 'cd '.$service->workdir();
1818
$commands[] = "echo 'Saved configuration files to {$service->workdir()}.'";
19-
if($service->networks()->count() > 0){
19+
if ($service->networks()->count() > 0) {
2020
$commands[] = "echo 'Creating Docker network.'";
2121
$commands[] = "docker network inspect $service->uuid >/dev/null 2>&1 || docker network create --attachable $service->uuid";
2222
}
@@ -31,7 +31,7 @@ public function handle(Service $service)
3131
$network = $service->destination->network;
3232
$serviceNames = data_get(Yaml::parse($compose), 'services', []);
3333
foreach ($serviceNames as $serviceName => $serviceConfig) {
34-
$commands[] = "docker network connect --alias {$serviceName}-{$service->uuid} $network {$serviceName}-{$service->uuid} || true";
34+
$commands[] = "docker network connect --alias {$serviceName}-{$service->uuid} $network {$serviceName}-{$service->uuid} >/dev/null 2>&1 || true";
3535
}
3636
}
3737
$activity = remote_process($commands, $service->server, type_uuid: $service->uuid, callEventOnFinish: 'ServiceStatusChanged');

0 commit comments

Comments
 (0)