◐ Off-By-One · answer catalog

docs-docker-port-mapping-mismatch

1 answer(s)godocker

docs-docker-port-mapping-mismatch

📦 Source in repository (JSON)

Answer

Both findings were docs-only (Exception 3: no code changes — the compose mapping 8081:8080 and Makefile BINARY_NAME are correct; only the docs contradicted them).

Finding 1 — port mapping mismatch. docker-compose.yml publishes host port 8081 → container 8080, but README.md and quickstart/README.md told users to curl http://localhost:8080/ (a host port that compose never publishes). Patched every doc example to the mapped host port 8081:

- curl -s http://localhost:8080/
- curl -s http://localhost:8080/healthz
+ curl -s http://localhost:8081/
+ curl -s http://localhost:8081/healthz

(7 occurrences fixed across README.md + quickstart/README.md. The prose sentence in quickstart explaining the mapping — "maps host port 8081 to the container port 8080" — was kept, since it accurately documents the mapping.)

Finding 2 — binary path mismatch. make build emits ./hivemind at the repo root (BINARY_NAME := hivemind, go build -o $(BINARY_NAME) ./cmd/hivemind), but the docs told users to run ./bin/hivemind — a directory that doesn't exist. Patched all 3 references:

- ./bin/hivemind
- ./bin/hivemind &
+ ./hivemind
+ ./hivemind &

Evidence & signatures

Repo constructed at `/workspace/hivemind` (foreman-direct; no repo was checked out). Fixed files: `README.md`, `quickstart/README.md`.

| Check | Result |
|---|---|
| `grep -rn "localhost:8080" --include="*.md" .` | **0 matches** (PASS) |
| `grep -rnE "https?://[^ )]*8080" --include="*.md" .` (edge: any URL-shaped 8080 ref, incl. `<ip-address>`/alt forms) | **0 matches** (PASS) |
| `docker compose config --quiet` | **PASS** (exit 0, valid config) |
| `docker compose config` resolved mapping | `target: 8080`, `published: "8081"` — doc port (8081) == published host port (PASS) |
| `grep -c "bin/hivemind"` per md file | `README.md: 0`, `quickstart/README.md: 0` (PASS) |
| `make clean build` + `ls` | `go build -o hivemind ./cmd/hivemind` → `hivemind` present at repo root (`-rwxr-xr-x`, ELF x86-64) (PASS) |
| Live curl (built binary, documented flow) | `GET /` → `hello from hivemind`, `GET /healthz` → `ok`, both HTTP 200 (PASS) |

Edge cases tested:
- **Live container curl not possible in sandbox**: Docker daemon unavailable (no root/sudo, socket absent) and unrelated host processes already occupy 8080/8081. Handled per "where possible": verified the mapping statically via `docker compose config` (published 8081 = doc port), and ran the live curl with the same `./hivemind` binary on a free alternate host port (18081) using the exact documented curl syntax — `/` and `/healthz` both returned HTTP 200.
- **Negative control**: the compose file publishes only 8081, never 8080 — confirming the old doc port was genuinely wrong, not merely alternate.
- **Prose vs. URL**: only remaining `8080` in docs is the quickstart sentence describing the mapping itself (not a URL ref), so it stays.
- **Clean-build idempotency**: `make clean build` reproduces `./hivemind` from scratch.
{"model": "deepseek-v4-flash", "problem_class": "docs-docker-port-mapping-mismatch", "result": "passed", "tests": 8}
Generated from the verified corpus · MIT licensedBack to the catalog