Skip to content

Commit 1f2a776

Browse files
committed
docs: clarify --add-host example uses two terminals
Signed-off-by: WilliamK112 <164879897+WilliamK112@users.noreply.github.com>
1 parent 0b459a4 commit 1f2a776

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

docs/reference/commandline/container_run.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1290,10 +1290,17 @@ The following example shows how the special `host-gateway` value works. The
12901290
example runs an HTTP server that serves a file from host to container over the
12911291
`host.docker.internal` hostname, which resolves to the host's internal IP.
12921292

1293+
In one terminal, create the file and start an HTTP server:
1294+
12931295
```console
12941296
$ echo "hello from host!" > ./hello
12951297
$ python3 -m http.server 8000
12961298
Serving HTTP on 0.0.0.0 port 8000 (http://0.0.0.0:8000/) ...
1299+
```
1300+
1301+
In another terminal, run a container that connects to the HTTP server:
1302+
1303+
```console
12971304
$ docker run \
12981305
--add-host host.docker.internal=host-gateway \
12991306
curlimages/curl -s host.docker.internal:8000/hello

0 commit comments

Comments
 (0)