Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions docs/reference/commandline/container_run.md
Original file line number Diff line number Diff line change
Expand Up @@ -1292,14 +1292,19 @@ example runs an HTTP server that serves a file from host to container over the

```console
$ echo "hello from host!" > ./hello
$ python3 -m http.server 8000
$ python3 -m http.server 8000 &
[1] 401234
Serving HTTP on 0.0.0.0 port 8000 (http://0.0.0.0:8000/) ...
$ docker run \
$ docker run --rm \
--add-host host.docker.internal=host-gateway \
curlimages/curl -s host.docker.internal:8000/hello
hello from host!
$ kill %1
```

The HTTP server must keep running while you start the container. Run it in the
background (as above) or in a second terminal, then stop it when you are done.

The `--add-host` flag also accepts a `:` separator, for example:

```console
Expand Down