{"record":{"id":"45de057eee8aa76d","repo":"coollabsio/coolify","slug":"docker-swarm-is-not-initiated-please-join-the-ser","errorCode":null,"errorMessage":"Docker Swarm is not initiated. Please join the server to a swarm before continuing.","messagePattern":"Docker Swarm is not initiated\\. Please join the server to a swarm before continuing\\.","errorType":"exception","errorClass":"Exception","httpStatus":null,"severity":"error","filePath":"app/Models/Server.php","lineNumber":1613,"sourceCode":"            $this->settings->save();\n            if ($throwError) {\n                throw new \\Exception('Server is not usable. Docker Compose is not installed.');\n            }\n\n            return false;\n        }\n        $this->settings->is_usable = true;\n        $this->settings->save();\n\n        return true;\n    }\n\n    public function validateDockerSwarm()\n    {\n        $swarmStatus = instant_remote_process(['docker info|grep -i swarm'], $this, false);\n        $swarmStatus = str($swarmStatus)->trim()->after(':')->trim();\n        if ($swarmStatus === 'inactive') {\n            throw new \\Exception('Docker Swarm is not initiated. Please join the server to a swarm before continuing.');\n\n            return false;\n        }\n        $this->settings->is_usable = true;\n        $this->settings->save();\n        $this->validateCoolifyNetwork(isSwarm: true);\n\n        return true;\n    }\n\n    public function dockerVersion(): ?string\n    {\n        return $this->settings?->docker_version;\n    }\n\n    public function rememberDockerVersion(?string $version): void\n    {\n        $this->settings->update([","sourceCodeStart":1595,"sourceCodeEnd":1631,"githubUrl":"https://github.com/coollabsio/coolify/blob/70b9acc42467278373e00de77abb40684e25b395/app/Models/Server.php#L1595-L1631","documentation":"Thrown by Server::validateDockerSwarm() (app/Models/Server.php:1613). The method SSHes to the server, runs `docker info|grep -i swarm`, takes the value after 'Swarm:' and throws when it equals 'inactive' — i.e. the remote Docker daemon is not in swarm mode. It is a precondition check before Coolify accepts the server for a SwarmDocker destination (which needs an overlay network, created afterwards via validateCoolifyNetwork(isSwarm: true)). The unreachable `return false` after the throw shows it was converted from a boolean API to a hard failure.","triggerScenarios":"Calling $server->validateDockerSwarm() (directly or via server validation before adding/using a Swarm Docker destination) on a host where `docker info` reports 'Swarm: inactive' because `docker swarm init` / `docker swarm join` was never run.","commonSituations":"Adding a server intended for Swarm deployments without initializing swarm mode first; fresh Docker installs; hosts where swarm mode was left (`docker swarm leave`) or never configured; using the Swarm destination flow on a standalone-Docker host.","solutions":["SSH into the target server and run `docker swarm init` (single-node) or `docker swarm join --token <token> <manager:2377>` to join an existing swarm, then re-run validation in Coolify","Verify with `docker info | grep -i swarm` that it now reports 'active' before retrying","If swarm was not intended, use a Standalone Docker destination instead of SwarmDocker so validateDockerSwarm is never invoked","If the check seems to pass unexpectedly, confirm SSH actually returns output — a silently failed command yields an empty string, not 'inactive'"],"exampleFix":"# on the target server, before validating in Coolify\ndocker info | grep -i swarm      # Swarm: inactive  -> error will throw\ndocker swarm init               # Swarm: active\ndocker info | grep -i swarm      # now passes validateDockerSwarm()","handlingStrategy":"validation","validationCode":"$state = str(instant_remote_process(['docker info|grep -i swarm'], $server, false))->trim()->after(':')->trim();\nif ($state->value() !== 'active') {\n    // tell the user to run: docker swarm init (or docker swarm join ...)\n    return back()->withErrors(['server' => 'Enable swarm mode on the host first.']);\n}\n$server->validateDockerSwarm();","typeGuard":null,"tryCatchPattern":"try {\n    $server->validateDockerSwarm();\n} catch (\\Exception $e) {\n    // Message already says 'join the server to a swarm'; surface it and link to `docker swarm init` docs instead of showing a raw 500.\n}","preventionTips":["Run `docker swarm init` before adding Swarm destinations","Verify with `docker info | grep -i swarm` from the Coolify host's SSH session","Use Standalone Docker destinations for non-swarm hosts"],"tags":["docker","docker-swarm","server-validation","ssh"],"backgroundTag":"docker-swarm-inactive","analyzedSha":"70b9acc42467278373e00de77abb40684e25b395","analyzedAt":"2026-08-17T01:41:01.313Z","schemaVersion":2},"datasetVersion":"2026-08-17T04:17:16.089Z"}