Skip to content

fix(shell): avoid docker SSH port collisions and improve docker compose hints#71

Merged
skulidropek merged 3 commits intoProverCoderAI:mainfrom
skulidropek:issue-66
Feb 19, 2026
Merged

fix(shell): avoid docker SSH port collisions and improve docker compose hints#71
skulidropek merged 3 commits intoProverCoderAI:mainfrom
skulidropek:issue-66

Conversation

@skulidropek
Copy link
Copy Markdown
Member

Summary

  • treat Docker-published host ports as reserved during SSH port selection (not only raw TCP bind checks)
  • keep port selection deterministic by merging project index reservations + docker ps published ports
  • improve DockerCommandError user hint with explicit recovery for port is already allocated (--ssh-port <port> or stop conflicting container)

Why

Docker can reserve host ports via NAT while no host socket is visible. In that case isPortAvailable() may return a false free signal and docker compose up fails later with Bind for 127.0.0.1:<port> failed: port is already allocated.

Validation

  • pnpm -C packages/lib test
  • pnpm -C packages/lib typecheck
  • pnpm --filter ./packages/app build:docker-git
  • manual repro: pnpm run docker-git clone https://github.com/ProverCoderAI/docker-git/issues/65 --force now auto-reassigns 2222 -> 2225 and starts successfully

Mathematical Guarantees

  • Invariant: if a host port is already published by any running Docker container, the allocator does not select it
  • Invariant: error message for compose failure includes actionable recovery for port allocation conflicts

Related: #66

@skulidropek skulidropek merged commit d768913 into ProverCoderAI:main Feb 19, 2026
11 checks passed
@skulidropek
Copy link
Copy Markdown
Member Author

#65

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant