From 1f2a776c1c1d9fab1ed658188d0becb3ba974b43 Mon Sep 17 00:00:00 2001 From: WilliamK112 <164879897+WilliamK112@users.noreply.github.com> Date: Sat, 25 Apr 2026 02:36:29 -0500 Subject: [PATCH] docs: clarify --add-host example uses two terminals Signed-off-by: WilliamK112 <164879897+WilliamK112@users.noreply.github.com> --- docs/reference/commandline/container_run.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/docs/reference/commandline/container_run.md b/docs/reference/commandline/container_run.md index dcf4c52f41e2..06c996ae8b7d 100644 --- a/docs/reference/commandline/container_run.md +++ b/docs/reference/commandline/container_run.md @@ -1290,10 +1290,17 @@ The following example shows how the special `host-gateway` value works. The example runs an HTTP server that serves a file from host to container over the `host.docker.internal` hostname, which resolves to the host's internal IP. +In one terminal, create the file and start an HTTP server: + ```console $ echo "hello from host!" > ./hello $ python3 -m http.server 8000 Serving HTTP on 0.0.0.0 port 8000 (http://0.0.0.0:8000/) ... +``` + +In another terminal, run a container that connects to the HTTP server: + +```console $ docker run \ --add-host host.docker.internal=host-gateway \ curlimages/curl -s host.docker.internal:8000/hello