{"record":{"id":"3e14e1fc4e8fa98a","repo":"coollabsio/coolify","slug":"port-port-is-in-use-br-you-must-stop-the-process","errorCode":null,"errorMessage":"Port $port is in use.<br>You must stop the process using this port.<br><br>Docs: <a target='_blank' class='dark:text-white hover:underline' href='https://coolify.io/docs'>https://coolify.io/docs</a><br>Discord: <a target='_blank' class='dark:text-white hover:underline' href='https://coolify.io/discord'>https://coolify.io/discord</a>","messagePattern":"Port \\$port is in use\\.<br>You must stop the process using this port\\.<br><br>Docs: <a target='_blank' class='dark:text-white hover:underline' href='https://coolify\\.io/docs'>https://coolify\\.io/docs</a><br>Discord: <a target='_blank' class='dark:text-white hover:underline' href='https://coolify\\.io/discord'>https://coolify\\.io/discord</a>","errorType":"exception","errorClass":"Exception","httpStatus":null,"severity":"error","filePath":"app/Actions/Proxy/CheckProxy.php","lineNumber":105,"sourceCode":"                        // Combine default ports with config ports\n                        $portsToCheck = array_merge($portsToCheck, $configPorts);\n                    }\n                } else {\n                    $portsToCheck = [];\n                }\n            } catch (\\Exception $e) {\n                Log::error('Error checking proxy: '.$e->getMessage());\n            }\n            if (count($portsToCheck) === 0) {\n                return false;\n            }\n            $portsToCheck = array_values(array_unique($portsToCheck));\n            // Check port conflicts in parallel\n            $conflicts = $this->checkPortConflictsInParallel($server, $portsToCheck, $proxyContainerName);\n            foreach ($conflicts as $port => $conflict) {\n                if ($conflict) {\n                    if ($fromUI) {\n                        throw new \\Exception(\"Port $port is in use.<br>You must stop the process using this port.<br><br>Docs: <a target='_blank' class='dark:text-white hover:underline' href='https://coolify.io/docs'>https://coolify.io/docs</a><br>Discord: <a target='_blank' class='dark:text-white hover:underline' href='https://coolify.io/discord'>https://coolify.io/discord</a>\");\n                    } else {\n                        return false;\n                    }\n                }\n            }\n\n            return true;\n        }\n    }\n\n    /**\n     * Check multiple ports for conflicts in parallel\n     * Returns an array with port => conflict_status mapping\n     */\n    private function checkPortConflictsInParallel(Server $server, array $ports, string $proxyContainerName): array\n    {\n        if (empty($ports)) {\n            return [];","sourceCodeStart":87,"sourceCodeEnd":123,"githubUrl":"https://github.com/coollabsio/coolify/blob/70b9acc42467278373e00de77abb40684e25b395/app/Actions/Proxy/CheckProxy.php#L87-L123","documentation":"\\Exception thrown from CheckProxy when $fromUI is true and the parallel port-conflict scan finds one of the proxy's required ports (typically 80/443/8080) already bound by another process on the server. The message intentionally embeds HTML links to docs/Discord because it is rendered in the Livewire error toast. Non-UI callers get false (proxy start skipped).","triggerScenarios":"Starting/restarting coolify-proxy from the UI while nginx, apache, another container, or a second coolify-proxy instance already listens on 80/443/8080; a stale coolify-proxy container still holding ports after a partial restart; Swarm vs non-Swarm name mismatch leaving an orphan container.","commonSituations":"Fresh server with a pre-existing web server; port changed in proxy config but an old process still bound; duplicated proxy containers (coolify-proxy vs coolify-proxy_traefik) after switching Swarm mode; another app deployed with host networking on the same ports.","solutions":["SSH to the server and identify the holder: `ss -tulpn | grep -E ':(80|443|8080)\\s'`, then stop/disable that service (e.g. systemctl stop nginx).","If the holder is an orphaned coolify-proxy container: `docker rm -f coolify-proxy` (or coolify-proxy_traefik on Swarm) and retry Start Proxy.","If the ports must stay occupied, change the proxy's exposed ports in Coolify's proxy configuration or move the conflicting service elsewhere."],"exampleFix":"# before clicking Start Proxy, on the server\n# (find and stop the conflicting process)\nss -tulpn | grep -E ':(80|443|8080)\\s'\nsystemctl stop nginx && systemctl disable nginx\n# then retry Start Proxy in the UI","handlingStrategy":"validation","validationCode":"// before starting proxy, verify required ports are free on the server\n$ports = [80, 443, 8080];\n$output = instant_remote_process(['ss -tulpn | grep -E \":(80|443|8080)\\\\s\" || true'], $server, throwError: false);\nif (trim((string) $output) !== '') {\n    // resolve conflicts before calling Start Proxy\n}","typeGuard":null,"tryCatchPattern":"try {\n    CheckProxy::run($server, true);\n} catch (\\Exception $e) {\n    if (str_contains($e->getMessage(), 'is in use')) {\n        // parse the port, prompt user to stop the holder, then retry\n    } else {\n        throw $e;\n    }\n}","preventionTips":["Dedicate servers to Coolify: stop/disable system webservers (nginx/apache) before adding the server.","Check `ss -tulpn` for 80/443/8080 as part of server onboarding.","After Swarm/local mode switches, remove orphaned proxy containers (coolify-proxy vs coolify-proxy_traefik).","Prefer published-port apps over host-network apps on proxy servers to avoid port clashes."],"tags":["proxy","port-conflict","docker","networking"],"backgroundTag":"port-already-in-use","analyzedSha":"70b9acc42467278373e00de77abb40684e25b395","analyzedAt":"2026-08-17T01:41:01.313Z","schemaVersion":2},"datasetVersion":"2026-08-17T04:17:16.089Z"}