diff --git a/docker/get-n8n.sh b/docker/get-n8n.sh index 6907d770152..ec468475aa0 100755 --- a/docker/get-n8n.sh +++ b/docker/get-n8n.sh @@ -94,9 +94,11 @@ parse_args() { check_deps() { command -v docker >/dev/null 2>&1 || fail "Docker is not installed. Install it first: - Linux: https://docs.docker.com/engine/install/ + Linux / WSL: curl -fsSL https://get.docker.com | sh + then: sudo usermod -aG docker \$USER && re-open your shell macOS: https://docs.docker.com/desktop/setup/install/mac-install/ - Windows (WSL): https://docs.docker.com/desktop/setup/install/windows-install/ + Windows: https://docs.docker.com/desktop/setup/install/windows-install/ + (enable your distro under Settings > Resources > WSL integration) Podman, Colima and other Docker-compatible engines work too: install the 'docker' CLI with the compose plugin and point DOCKER_HOST at their socket." @@ -141,19 +143,22 @@ http_get() { } port_in_use() { + # In use only when something actually answers. Refusals AND timeouts count + # as free: Windows firewalls/WSL drop instead of refusing, which made the + # old "anything but refused" check a false positive. --noproxy keeps a + # corporate proxy from answering on 127.0.0.1's behalf. Ambiguous cases + # fall through to the container healthcheck, which surfaces real conflicts. if command -v curl >/dev/null 2>&1; then - # Any HTTP response (even an error status) means something is listening; - # only "connection refused" (rc 7) means the port is free. rc=0 - curl -s -o /dev/null --max-time 2 "http://127.0.0.1:${N8N_PORT}/" 2>/dev/null || rc=$? - [ "$rc" -ne 7 ] + curl -s -o /dev/null --noproxy '*' --max-time 2 "http://127.0.0.1:${N8N_PORT}/" 2>/dev/null || rc=$? + # rc 0 = HTTP response; 52/56 = connection accepted but no/broken reply. + [ "$rc" -eq 0 ] || [ "$rc" -eq 52 ] || [ "$rc" -eq 56 ] elif command -v wget >/dev/null 2>&1; then - # wget rc 4 = network failure (connection refused) = port free. rc=0 - wget -q -O /dev/null -T 2 "http://127.0.0.1:${N8N_PORT}/" 2>/dev/null || rc=$? - [ "$rc" -ne 4 ] + wget -q -O /dev/null --no-proxy -T 2 "http://127.0.0.1:${N8N_PORT}/" 2>/dev/null || rc=$? + # rc 0 = OK response; 8 = server issued an error response. + [ "$rc" -eq 0 ] || [ "$rc" -eq 8 ] else - # No way to check; let the healthcheck surface conflicts later. return 1 fi }