Skip to content

feat: add --port flag to openhands serve - #794

Closed
singhharsh1708 wants to merge 1 commit into
OpenHands:mainfrom
singhharsh1708:feat/serve-port-flag
Closed

feat: add --port flag to openhands serve#794
singhharsh1708 wants to merge 1 commit into
OpenHands:mainfrom
singhharsh1708:feat/serve-port-flag

Conversation

@singhharsh1708

Copy link
Copy Markdown

Why

openhands serve hardcodes host port 3000 for the Docker container (-p 3000:3000), with no way to override it. Since 3000 is also the default dev-server port for many frontend frameworks (Next.js, Vite, CRA), this creates a port conflict for developers who want to run OpenHands alongside their own project.

Summary

  • Add --port <PORT> option to openhands serve, default 3000
  • Map host --port to the container's fixed port 3000 (-p <PORT>:3000)
  • Update the printed "server will be available at" URL to reflect the chosen port

Issue Number

Closes #779

How to Test

openhands serve --port 4000 should start the container with -p 4000:3000 and print http://localhost:4000. openhands serve with no flag keeps the previous default of 3000.

Added a unit test (test_launch_gui_server_custom_port) asserting the docker command maps 4000:3000, and updated the existing test_main_serve_calls_launch_gui_server parametrization to cover the new kwarg. Full test suite run locally: 1402 passed.

Type

  • Feature

Notes

No change to default behavior; --port is optional and defaults to 3000.

@github-actions

Copy link
Copy Markdown
Contributor

This PR is stale because it has been open for 40 days with no activity. Remove the stale label or leave a comment, otherwise it will be closed in 10 days.

@github-actions github-actions Bot added the Stale label Aug 24, 2026
@github-actions

github-actions Bot commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

This PR was closed because it had no activity for 50 days. If you feel this was closed in error, and you would like to continue the PR, please resubmit or let us know.

@github-actions github-actions Bot closed this Sep 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature]: Add --port flag to openhands serve

1 participant