fix(proxy): restore project networks after host reboot (#11476)

This commit is contained in:
Andras Bacsai 2026-08-24 00:22:29 +02:00 committed by GitHub
parent c1219576cf
commit 16352fad23
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 3 additions and 3 deletions

View file

@ -123,7 +123,7 @@ function connectProxyToNetworks(Server $server)
}
return collect([
'for network in $(docker inspect $(docker ps --filter label=coolify.managed=true --format "{{.ID}}") --format=\'{{range $network, $_ := .NetworkSettings.Networks}}{{println $network}}{{end}}\' 2>/dev/null | sort -u); do',
'for network in $(docker inspect $(docker ps -a --filter label=coolify.managed=true --format "{{.ID}}") --format=\'{{range $network, $_ := .NetworkSettings.Networks}}{{println $network}}{{end}}\' 2>/dev/null | sort -u); do',
' if [ -z "$network" ] || [ "$network" = "bridge" ] || [ "$network" = "host" ] || [ "$network" = "none" ] || [ "$network" = "default" ]; then',
' continue',
' fi',

View file

@ -6,14 +6,14 @@
uses(RefreshDatabase::class);
it('discovers running container networks instead of relying on cached resource statuses', function () {
it('discovers managed container networks regardless of container status', function () {
$team = Team::factory()->create();
$server = Server::factory()->create(['team_id' => $team->id]);
$commands = connectProxyToNetworks($server)->implode("\n");
expect($commands)
->toContain('docker ps --filter label=coolify.managed=true')
->toContain('docker ps -a --filter label=coolify.managed=true')
->toContain('.NetworkSettings.Networks')
->toContain('docker network inspect "$network"')
->toContain('docker network connect "$network" coolify-proxy')