Skip to content

Commit ee3e07d

Browse files
committed
Merge pull request moby#18301 from wenchma/doc_update_for_net
Add NETWORK_NAME_or_ID value for --net= option
2 parents 6deec02 + 08328cb commit ee3e07d

File tree

7 files changed

+33
-24
lines changed

7 files changed

+33
-24
lines changed

contrib/completion/zsh/_docker

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -278,7 +278,7 @@ __docker_network_commands() {
278278
"disconnect:Disconnects a container from a network"
279279
"inspect:Displays detailed information on a network"
280280
"ls:Lists all the networks created by the user"
281-
"rm:Deletes a network"
281+
"rm:Deletes one or more networks"
282282
)
283283
_describe -t docker-network-commands "docker network command" _docker_network_subcommands
284284
}

docs/reference/commandline/create.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,12 @@ Creates a new container.
5656
--memory-swap="" Total memory (memory + swap), '-1' to disable swap
5757
--memory-swappiness="" Tune a container's memory swappiness behavior. Accepts an integer between 0 and 100.
5858
--name="" Assign a name to the container
59-
--net="default" Set the Network mode for the container
59+
--net="bridge" Connect a container to a network
60+
'bridge': create a network stack on the default Docker bridge
61+
'none': no networking
62+
'container:<name|id>': reuse another container's network stack
63+
'host': use the Docker host network stack
64+
'<network-name>|<network-id>': connect to a user-defined network
6065
--oom-kill-disable=false Whether to disable OOM Killer for the container or not
6166
--oom-score-adj=0 Tune the host's OOM preferences for containers (accepts -1000 to 1000)
6267
-P, --publish-all=false Publish all exposed ports to random ports

docs/reference/commandline/run.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -55,12 +55,12 @@ parent = "smn_cli"
5555
--memory-swap="" Total memory (memory + swap), '-1' to disable swap
5656
--memory-swappiness="" Tune a container's memory swappiness behavior. Accepts an integer between 0 and 100.
5757
--name="" Assign a name to the container
58-
--net="bridge" Connects a container to a network
59-
'bridge': creates a new network stack for the container on the docker bridge
60-
'none': no networking for this container
61-
'container:<name|id>': reuses another container network stack
62-
'host': use the host network stack inside the container
63-
'NETWORK': connects the container to user-created network using `docker network create` command
58+
--net="bridge" Connect a container to a network
59+
'bridge': create a network stack on the default Docker bridge
60+
'none': no networking
61+
'container:<name|id>': reuse another container's network stack
62+
'host': use the Docker host network stack
63+
'<network-name>|<network-id>': connect to a user-defined network
6464
--oom-kill-disable=false Whether to disable OOM Killer for the container or not
6565
--oom-score-adj=0 Tune the host's OOM preferences for containers (accepts -1000 to 1000)
6666
-P, --publish-all=false Publish all exposed ports to random ports

docs/reference/run.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -244,12 +244,12 @@ of the containers.
244244
## Network settings
245245

246246
--dns=[] : Set custom dns servers for the container
247-
--net="bridge" : Connects a container to a network
248-
'bridge': creates a new network stack for the container on the docker bridge
249-
'none': no networking for this container
250-
'container:<name|id>': reuses another container network stack
251-
'host': use the host network stack inside the container
252-
'NETWORK': connects the container to user-created network using `docker network create` command
247+
--net="bridge" : Connect a container to a network
248+
'bridge': create a network stack on the default Docker bridge
249+
'none': no networking
250+
'container:<name|id>': reuse another container's network stack
251+
'host': use the Docker host network stack
252+
'<network-name>|<network-id>': connect to a user-defined network
253253
--add-host="" : Add a line to /etc/hosts (host:IP)
254254
--mac-address="" : Sets the container's Ethernet device's MAC address
255255

docs/userguide/networking/default_network/container-basics.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ DRAFT to prevent building. Keeping for one cycle before deleting.
1515

1616
# How the default network
1717

18-
The information in this section explains configuring container DNS within tthe Docker default bridge. This is a `bridge` network named `bridge` created
18+
The information in this section explains configuring container networks within the Docker default bridge. This is a `bridge` network named `bridge` created
1919
automatically when you install Docker.
2020

2121
**Note**: The [Docker networks feature](../dockernetworks.md) allows you to create user-defined networks in addition to the default bridge network.
@@ -40,7 +40,7 @@ The steps with which Docker configures a container are:
4040

4141
With these steps complete, the container now possesses an `eth0` (virtual) network card and will find itself able to communicate with other containers and the rest of the Internet.
4242

43-
You can opt out of the above process for a particular container by giving the `--net=` option to `docker run`, which takes four possible values.
43+
You can opt out of the above process for a particular container by giving the `--net=` option to `docker run`, which takes these possible values.
4444
- `--net=bridge` -- The default action, that connects the container to the Docker bridge as described above.
4545

4646
- `--net=host` -- Tells Docker to skip placing the container inside of a separate network stack. In essence, this choice tells Docker to **not containerize the container's networking**! While container processes will still be confined to their own filesystem and process list and resource limits, a quick `ip addr` command will show you that, network-wise, they live "outside" in the main Docker host and have full access to its network interfaces. Note that this does **not** let the container reconfigure the host network stack -- that would require `--privileged=true` -- but it does let container processes open low-numbered ports like any other root process. It also allows the container to access local network services like D-bus. This can lead to processes in the container being able to do unexpected things like [restart your computer](https://github.com/docker/docker/issues/6401). You should use this option with caution.
@@ -49,6 +49,8 @@ You can opt out of the above process for a particular container by giving the `-
4949

5050
- `--net=none` -- Tells Docker to put the container inside of its own network stack but not to take any steps to configure its network, leaving you free to build any of the custom configurations explored in the last few sections of this document.
5151

52+
- `--net=<network-name>|<network-id>` -- Tells Docker to connect the container to a user-defined network.
53+
5254
## Manually network
5355

5456
To get an idea of the steps that are necessary if you use `--net=none` as described in that last bullet point, here are the commands that you would run to reach roughly the same configuration as if you had let Docker do all of the configuration:

man/docker-create.1.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -227,10 +227,11 @@ This value should always larger than **-m**, so you should always use this with
227227

228228
**--net**="*bridge*"
229229
Set the Network mode for the container
230-
'bridge': creates a new network stack for the container on the docker bridge
231-
'none': no networking for this container
232-
'container:<name|id>': reuses another container network stack
233-
'host': use the host network stack inside the container. Note: the host mode gives the container full access to local system services such as D-bus and is therefore considered insecure.
230+
'bridge': create a network stack on the default Docker bridge
231+
'none': no networking
232+
'container:<name|id>': reuse another container's network stack
233+
'host': use the Docker host network stack. Note: the host mode gives the container full access to local system services such as D-bus and is therefore considered insecure.
234+
'<network-name>|<network-id>': connect to a user-defined network
234235

235236
**--oom-kill-disable**=*true*|*false*
236237
Whether to disable OOM Killer for the container or not.

man/docker-run.1.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -339,10 +339,11 @@ and foreground Docker containers.
339339

340340
**--net**="*bridge*"
341341
Set the Network mode for the container
342-
'bridge': creates a new network stack for the container on the docker bridge
343-
'none': no networking for this container
344-
'container:<name|id>': reuses another container network stack
345-
'host': use the host network stack inside the container. Note: the host mode gives the container full access to local system services such as D-bus and is therefore considered insecure.
342+
'bridge': create a network stack on the default Docker bridge
343+
'none': no networking
344+
'container:<name|id>': reuse another container's network stack
345+
'host': use the Docker host network stack. Note: the host mode gives the container full access to local system services such as D-bus and is therefore considered insecure.
346+
'<network-name>|<network-id>': connect to a user-defined network
346347

347348
**--oom-kill-disable**=*true*|*false*
348349
Whether to disable OOM Killer for the container or not.

0 commit comments

Comments
 (0)