Skip to content

Commit 6c78580

Browse files
committed
refactor: Improve start proxy script to handle existing containers gracefully
1 parent 75c8f6c commit 6c78580

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

app/Actions/Proxy/StartProxy.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,11 @@ public function handle(Server $server, bool $async = true, bool $force = false):
4646
"echo 'Creating required Docker Compose file.'",
4747
"echo 'Pulling docker image.'",
4848
'docker compose pull',
49-
"echo 'Stopping existing coolify-proxy.'",
50-
'docker stop -t 10 coolify-proxy || true',
51-
'docker rm coolify-proxy || true',
49+
'if docker ps -a --format "{{.Names}}" | grep -q "^coolify-proxy$"; then',
50+
" echo 'Stopping and removing existing coolify-proxy.'",
51+
' docker rm -f coolify-proxy || true',
52+
" echo 'Successfully stopped and removed existing coolify-proxy.'",
53+
'fi',
5254
"echo 'Starting coolify-proxy.'",
5355
'docker compose up -d --remove-orphans',
5456
"echo 'Proxy started successfully.'",

0 commit comments

Comments
 (0)