Skip to content

feat: implement automatic host port selection for Docker environment#6

Merged
vikashship merged 1 commit into
masterfrom
feat/auto-port-increment
Mar 25, 2026
Merged

feat: implement automatic host port selection for Docker environment#6
vikashship merged 1 commit into
masterfrom
feat/auto-port-increment

Conversation

@vikashship
Copy link
Copy Markdown
Owner

Description

This PR introduces automatic host port selection for the Docker environment so local startup does not fail when default ports are already in use.

Instead of stopping with address already in use errors, the startup flow now checks configured host ports and automatically moves to the next available port.

Why This Change

Local development frequently fails when common ports like MongoDB, Redis, API, or Nginx ports are occupied by other services. This creates unnecessary setup friction and blocks contributors.

What This PR Adds

  • Automatic port availability detection before Docker startup
  • Incremental fallback logic to the next free host port
  • Export of resolved port values for compose startup
  • Startup logs that clearly show final selected ports
  • Updated Docker startup commands to use the new resolver flow

Behavior Change

Before:

  • Startup failed immediately when a configured port was busy

After:

  • Startup continues by selecting the next free port automatically

Impact

  • Better developer experience during setup and daily runs
  • Fewer startup failures on shared/local machines
  • Non-breaking change to application runtime behavior

Testing Done

  • Verified resolver script syntax and execution path
  • Verified Docker startup command integration
  • Confirmed pre-commit workflow remains unaffected
  • Confirmed resolved ports are printed for visibility

Notes

  • Existing port environment variables are still supported
  • Configured values now act as preferred starting ports, with automatic fallback when unavailable

@vikashship vikashship merged commit 6d944d0 into master Mar 25, 2026
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