Skip to content

docs: fix --add-host example to run HTTP server in background - #7518

Open
indraoverflow wants to merge 1 commit into
docker:masterfrom
indraoverflow:fix/5558-add-host-example
Open

indraoverflow wants to merge 1 commit into
docker:masterfrom
indraoverflow:fix/5558-add-host-example

Conversation

@indraoverflow

Copy link
Copy Markdown

Description

The example for the --add-host flag with host-gateway ran the Python HTTP server in the foreground, preventing the user from running the docker run command in the same terminal. This change runs the server in the background and kills it after the curl command completes.

Verification

  • Tested the example locally: the background server approach works correctly.
  • The example now shows the job number ([1] 12345) and uses kill %1 to stop the server after the curl command.

Issue Reference

Fixes #5558

Checklist

  • Tests pass (documentation only change)
  • Code follows the style guidelines
  • Documentation updated (this is the documentation update)

Type of Change

  • Bug fix
  • New feature
  • Breaking change
  • Documentation update

An agent wrote it under close human direction.

Fixes docker#5558

The example for the --add-host flag with host-gateway ran the Python
HTTP server in the foreground, preventing the user from running the
docker command in the same terminal. This change runs the server in
the background and kills it after the curl command completes.

Signed-off-by: Indra Prasetya <[email protected]>
@indraoverflow
indraoverflow requested review from a team and thaJeztah as code owners November 12, 2026 22:43
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.

--add-host example doesn't work as shown

1 participant