mirror of https://github.com/docker/docs.git
engine: fix examples for the none nw driver
Signed-off-by: David Karlsson <david.karlsson@docker.com>
This commit is contained in:
parent
c2bb28fd38
commit
e67b18a889
|
@ -8,44 +8,26 @@ redirect_from:
|
||||||
|
|
||||||
If you want to completely disable the networking stack on a container, you can
|
If you want to completely disable the networking stack on a container, you can
|
||||||
use the `--network none` flag when starting the container. Within the container,
|
use the `--network none` flag when starting the container. Within the container,
|
||||||
only the loopback device is created. The following example illustrates this.
|
only the loopback device is created.
|
||||||
|
|
||||||
1. Create the container.
|
The following example runs shows the output of `ip link show` in an `alpine`
|
||||||
|
container using the `none` network driver.
|
||||||
|
|
||||||
```console
|
```console
|
||||||
$ docker run --rm -dit \
|
$ docker run --rm --network none alpine:latest ip link show
|
||||||
--network none \
|
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN qlen 1000
|
||||||
--name no-net-alpine \
|
|
||||||
alpine:latest \
|
|
||||||
ash
|
|
||||||
```
|
|
||||||
|
|
||||||
2. Check the container's network stack, by executing some common networking
|
|
||||||
commands within the container. Notice that no `eth0` was created.
|
|
||||||
|
|
||||||
```console
|
|
||||||
$ docker exec no-net-alpine ip link show
|
|
||||||
|
|
||||||
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN qlen 1
|
|
||||||
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
|
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
|
||||||
2: tunl0@NONE: <NOARP> mtu 1480 qdisc noop state DOWN qlen 1
|
```
|
||||||
link/ipip 0.0.0.0 brd 0.0.0.0
|
|
||||||
3: ip6tnl0@NONE: <NOARP> mtu 1452 qdisc noop state DOWN qlen 1
|
|
||||||
link/tunnel6 00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00 brd 00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00
|
|
||||||
```
|
|
||||||
|
|
||||||
```console
|
No IPv6 loopback address is configured for containers using the `none` driver.
|
||||||
$ docker exec no-net-alpine ip route
|
|
||||||
```
|
|
||||||
|
|
||||||
The second command returns empty because there is no routing table.
|
```console
|
||||||
|
$ docker run --rm --network none --name no-net-alpine alpine:latest ip addr show
|
||||||
3. Stop the container. It is removed automatically because it was created with
|
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN qlen 1000
|
||||||
the `--rm` flag.
|
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
|
||||||
|
inet 127.0.0.1/8 scope host lo
|
||||||
```console
|
valid_lft forever preferred_lft forever
|
||||||
$ docker stop no-net-alpine
|
```
|
||||||
```
|
|
||||||
|
|
||||||
## Next steps
|
## Next steps
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue