mirror of https://github.com/docker/cli.git
man: use "console" hints in markdown
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
parent
53f8ed4bec
commit
7236f78242
|
@ -24,8 +24,8 @@ our container needs access to a character device with major `42` and
|
|||
any number of minor number (added as new devices appear), the
|
||||
following rule would be added:
|
||||
|
||||
```
|
||||
docker create --device-cgroup-rule='c 42:* rmw' -name my-container my-image
|
||||
```console
|
||||
$ docker create --device-cgroup-rule='c 42:* rmw' -name my-container my-image
|
||||
```
|
||||
|
||||
Then, a user could ask `udev` to execute a script that would `docker exec my-container mknod newDevX c 42 <minor>`
|
||||
|
|
|
@ -14,7 +14,7 @@ You can use the full or shortened container ID or the container name set using
|
|||
|
||||
Inspect the changes to an `nginx` container:
|
||||
|
||||
```bash
|
||||
```console
|
||||
$ docker diff 1fdfd1f54c1b
|
||||
|
||||
C /dev
|
||||
|
|
|
@ -29,7 +29,7 @@ container.
|
|||
|
||||
In order to retrieve logs before a specific point in time, run:
|
||||
|
||||
```bash
|
||||
```console
|
||||
$ docker run --name test -d busybox sh -c "while true; do $(echo date); sleep 1; done"
|
||||
$ date
|
||||
Tue 14 Nov 2017 16:40:00 CET
|
||||
|
|
|
@ -40,7 +40,7 @@ To limit a container's cpu-shares to 512, first identify the container
|
|||
name or ID. You can use **docker ps** to find these values. You can also
|
||||
use the ID returned from the **docker run** command. Then, do the following:
|
||||
|
||||
```bash
|
||||
```console
|
||||
$ docker container update --cpu-shares 512 abebf7571666
|
||||
```
|
||||
|
||||
|
@ -48,7 +48,7 @@ $ docker container update --cpu-shares 512 abebf7571666
|
|||
|
||||
To update multiple resource configurations for multiple containers:
|
||||
|
||||
```bash
|
||||
```console
|
||||
$ docker container update --cpu-shares 512 -m 300M abebf7571666 hopeful_morse
|
||||
```
|
||||
|
||||
|
@ -64,19 +64,19 @@ NOTE: The **--kernel-memory** option has been deprecated since Docker 20.10.
|
|||
|
||||
For example, if you started a container with this command:
|
||||
|
||||
```bash
|
||||
```console
|
||||
$ docker run -dit --name test --kernel-memory 50M ubuntu bash
|
||||
```
|
||||
|
||||
You can update kernel memory while the container is running:
|
||||
|
||||
```bash
|
||||
```console
|
||||
$ docker container update --kernel-memory 80M test
|
||||
```
|
||||
|
||||
If you started a container *without* kernel memory initialized:
|
||||
|
||||
```bash
|
||||
```console
|
||||
$ docker run -dit --name test2 --memory 300M ubuntu bash
|
||||
```
|
||||
|
||||
|
@ -95,7 +95,7 @@ container.
|
|||
|
||||
To update restart policy for one or more containers:
|
||||
|
||||
```bash
|
||||
```console
|
||||
$ docker container update --restart=on-failure:3 abebf7571666 hopeful_morse
|
||||
```
|
||||
|
||||
|
|
|
@ -40,7 +40,7 @@ output the data exactly as the template declares or, when using the
|
|||
The following example uses a template without headers and outputs the
|
||||
`ID` and `CreatedSince` entries separated by a colon for all images:
|
||||
|
||||
```bash
|
||||
```console
|
||||
$ docker images --format "{{.ID}}: {{.CreatedSince}} ago"
|
||||
|
||||
cc1b61406712: 2 weeks ago
|
||||
|
|
|
@ -2,15 +2,16 @@ Connects a container to a network. You can connect a container by name
|
|||
or by ID. Once connected, the container can communicate with other containers in
|
||||
the same network.
|
||||
|
||||
```bash
|
||||
```console
|
||||
$ docker network connect multi-host-network container1
|
||||
```
|
||||
|
||||
You can also use the `docker run --network=<network-name>` option to start a container and immediately connect it to a network.
|
||||
|
||||
```bash
|
||||
```console
|
||||
$ docker run -itd --network=multi-host-network --ip 172.20.88.22 --ip6 2001:db8::8822 busybox
|
||||
```
|
||||
|
||||
You can pause, restart, and stop containers that are connected to a network.
|
||||
A container connects to its configured networks when it runs.
|
||||
|
||||
|
@ -21,11 +22,9 @@ to specify an `--ip-range` when creating the network, and choose the static IP
|
|||
address(es) from outside that range. This ensures that the IP address is not
|
||||
given to another container while this container is not on the network.
|
||||
|
||||
```bash
|
||||
```console
|
||||
$ docker network create --subnet 172.20.0.0/16 --ip-range 172.20.240.0/20 multi-host-network
|
||||
```
|
||||
|
||||
```bash
|
||||
$ docker network connect --ip 172.20.128.2 multi-host-network container2
|
||||
```
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@ on. When you launch a new container with `docker run` it automatically connects
|
|||
this bridge network. You cannot remove this default bridge network but you can
|
||||
create new ones using the `network create` command.
|
||||
|
||||
```bash
|
||||
```console
|
||||
$ docker network create -d bridge my-bridge-network
|
||||
```
|
||||
|
||||
|
@ -39,7 +39,7 @@ discovery and server management that can assist your implementation.
|
|||
Once you have prepared the `overlay` network prerequisites you simply choose a
|
||||
Docker host in the cluster and issue the following to create the network:
|
||||
|
||||
```bash
|
||||
```console
|
||||
$ docker network create -d overlay my-multihost-network
|
||||
```
|
||||
|
||||
|
@ -52,7 +52,7 @@ name conflicts.
|
|||
When you start a container use the `--network` flag to connect it to a network.
|
||||
This adds the `busybox` container to the `mynet` network.
|
||||
|
||||
```bash
|
||||
```console
|
||||
$ docker run -itd --network=mynet busybox
|
||||
```
|
||||
|
||||
|
@ -76,14 +76,14 @@ It is purely for ip-addressing purposes. You can override this default and
|
|||
specify subnetwork values directly using the `--subnet` option. On a
|
||||
`bridge` network you can only create a single subnet:
|
||||
|
||||
```bash
|
||||
```console
|
||||
$ docker network create -d bridge --subnet=192.168.0.0/16 br0
|
||||
```
|
||||
|
||||
Additionally, you also specify the `--gateway` `--ip-range` and `--aux-address`
|
||||
options.
|
||||
|
||||
```bash
|
||||
```console
|
||||
$ docker network create \
|
||||
--driver=bridge \
|
||||
--subnet=172.28.0.0/16 \
|
||||
|
@ -96,7 +96,7 @@ If you omit the `--gateway` flag the Engine selects one for you from inside a
|
|||
preferred pool. For `overlay` networks and for network driver plugins that
|
||||
support it you can create multiple subnetworks.
|
||||
|
||||
```bash
|
||||
```console
|
||||
$ docker network create -d overlay \
|
||||
--subnet=192.168.0.0/16 \
|
||||
--subnet=192.170.0.0/16 \
|
||||
|
@ -126,7 +126,7 @@ one ingress network can be created at the time. The network can be removed only
|
|||
if no services depend on it. Any option available when creating an overlay network
|
||||
is also available when creating the ingress network, besides the `--attachable` option.
|
||||
|
||||
```bash
|
||||
```console
|
||||
$ docker network create -d overlay \
|
||||
--subnet=10.11.0.0/16 \
|
||||
--ingress \
|
||||
|
@ -139,7 +139,7 @@ $ docker network create -d overlay \
|
|||
|
||||
You can create services on the predefined docker networks `bridge` and `host`.
|
||||
|
||||
```bash
|
||||
```console
|
||||
$ docker service create --name my-service \
|
||||
--network host \
|
||||
--replicas 2 \
|
||||
|
@ -152,7 +152,7 @@ You can create a swarm network with local scope network drivers. You do so
|
|||
by promoting the network scope to `swarm` during the creation of the network.
|
||||
You will then be able to use this network when creating services.
|
||||
|
||||
```bash
|
||||
```console
|
||||
$ docker network create -d bridge \
|
||||
--scope swarm \
|
||||
--attachable \
|
||||
|
@ -166,7 +166,7 @@ When you create the swarm scoped network, you will then specify the name of the
|
|||
network which contains the configuration.
|
||||
|
||||
|
||||
```bash
|
||||
```console
|
||||
node1$ docker network create --config-only --subnet 192.168.100.0/24 --gateway 192.168.100.115 mv-config
|
||||
node2$ docker network create --config-only --subnet 192.168.200.0/24 --gateway 192.168.200.202 mv-config
|
||||
node1$ docker network create -d macvlan --scope swarm --config-from mv-config --attachable swarm-network
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
Disconnects a container from a network.
|
||||
|
||||
```bash
|
||||
```console
|
||||
$ docker network disconnect multi-host-network container1
|
||||
```
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
Returns information about one or more networks. By default, this command renders all results in a JSON object. For example, if you connect two containers to the default `bridge` network:
|
||||
|
||||
```bash
|
||||
```console
|
||||
$ sudo docker run -itd --name=container1 busybox
|
||||
f2870c98fd504370fb86e59f32cd0753b1ac9b69b7d80566ffc7192a82b3ed27
|
||||
|
||||
|
@ -14,7 +14,7 @@ template for each result. Go's
|
|||
[text/template](http://golang.org/pkg/text/template/) package
|
||||
describes all the details of the format.
|
||||
|
||||
```bash
|
||||
```console
|
||||
$ sudo docker network inspect bridge
|
||||
[
|
||||
{
|
||||
|
@ -63,7 +63,7 @@ $ sudo docker network inspect bridge
|
|||
|
||||
Returns the information about the user-defined network:
|
||||
|
||||
```bash
|
||||
```console
|
||||
$ docker network create simple-network
|
||||
69568e6336d8c96bbf57869030919f7c69524f71183b44d80948bd3927c87f6a
|
||||
$ docker network inspect simple-network
|
||||
|
@ -95,7 +95,7 @@ and the IPs of the nodes where the tasks are running.
|
|||
Following is an example output for an overlay network `ov1` that has one service `s1`
|
||||
attached to. service `s1` in this case has three replicas.
|
||||
|
||||
```bash
|
||||
```console
|
||||
$ docker network inspect --verbose ov1
|
||||
[
|
||||
{
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
Lists all the networks the Engine `daemon` knows about. This includes the
|
||||
networks that span across multiple hosts in a cluster, for example:
|
||||
|
||||
```bash
|
||||
```console
|
||||
$ docker network ls
|
||||
NETWORK ID NAME DRIVER SCOPE
|
||||
7fca4eb8c647 bridge bridge local
|
||||
|
@ -12,7 +12,7 @@ networks that span across multiple hosts in a cluster, for example:
|
|||
|
||||
Use the `--no-trunc` option to display the full network id:
|
||||
|
||||
```bash
|
||||
```console
|
||||
$ docker network ls --no-trunc
|
||||
NETWORK ID NAME DRIVER
|
||||
18a2866682b85619a026c81b98a5e375bd33e1b0936a26cc497c283d27bae9b3 none null
|
||||
|
@ -44,7 +44,7 @@ The `driver` filter matches networks based on their driver.
|
|||
|
||||
The following example matches networks with the `bridge` driver:
|
||||
|
||||
```bash
|
||||
```console
|
||||
$ docker network ls --filter driver=bridge
|
||||
NETWORK ID NAME DRIVER
|
||||
db9db329f835 test1 bridge
|
||||
|
@ -58,7 +58,7 @@ The `id` filter matches on all or part of a network's ID.
|
|||
The following filter matches all networks with an ID containing the
|
||||
`63d1ff1f77b0...` string.
|
||||
|
||||
```bash
|
||||
```console
|
||||
$ docker network ls --filter id=63d1ff1f77b07ca51070a8c227e962238358bd310bde1529cf62e6c307ade161
|
||||
NETWORK ID NAME DRIVER
|
||||
63d1ff1f77b0 dev bridge
|
||||
|
@ -66,7 +66,7 @@ NETWORK ID NAME DRIVER
|
|||
|
||||
You can also filter for a substring in an ID as this shows:
|
||||
|
||||
```bash
|
||||
```console
|
||||
$ docker network ls --filter id=95e74588f40d
|
||||
NETWORK ID NAME DRIVER
|
||||
95e74588f40d foo bridge
|
||||
|
@ -83,7 +83,7 @@ value.
|
|||
|
||||
The following filter matches networks with the `usage` label regardless of its value.
|
||||
|
||||
```bash
|
||||
```console
|
||||
$ docker network ls -f "label=usage"
|
||||
NETWORK ID NAME DRIVER
|
||||
db9db329f835 test1 bridge
|
||||
|
@ -92,7 +92,7 @@ f6e212da9dfd test2 bridge
|
|||
|
||||
The following filter matches networks with the `usage` label with the `prod` value.
|
||||
|
||||
```bash
|
||||
```console
|
||||
$ docker network ls -f "label=usage=prod"
|
||||
NETWORK ID NAME DRIVER
|
||||
f6e212da9dfd test2 bridge
|
||||
|
@ -104,7 +104,7 @@ The `name` filter matches on all or part of a network's name.
|
|||
|
||||
The following filter matches all networks with a name containing the `foobar` string.
|
||||
|
||||
```bash
|
||||
```console
|
||||
$ docker network ls --filter name=foobar
|
||||
NETWORK ID NAME DRIVER
|
||||
06e7eef0a170 foobar bridge
|
||||
|
@ -112,7 +112,7 @@ NETWORK ID NAME DRIVER
|
|||
|
||||
You can also filter for a substring in a name as this shows:
|
||||
|
||||
```bash
|
||||
```console
|
||||
$ docker network ls --filter name=foo
|
||||
NETWORK ID NAME DRIVER
|
||||
95e74588f40d foo bridge
|
||||
|
@ -125,7 +125,7 @@ The `scope` filter matches networks based on their scope.
|
|||
|
||||
The following example matches networks with the `swarm` scope:
|
||||
|
||||
```bash
|
||||
```console
|
||||
$ docker network ls --filter scope=swarm
|
||||
NETWORK ID NAME DRIVER SCOPE
|
||||
xbtm0v4f1lfh ingress overlay swarm
|
||||
|
@ -134,7 +134,7 @@ ic6r88twuu92 swarmnet overlay swarm
|
|||
|
||||
The following example matches networks with the `local` scope:
|
||||
|
||||
```bash
|
||||
```console
|
||||
$ docker network ls --filter scope=local
|
||||
NETWORK ID NAME DRIVER SCOPE
|
||||
e85227439ac7 bridge bridge local
|
||||
|
@ -150,7 +150,7 @@ The `type` filter supports two values; `builtin` displays predefined networks
|
|||
|
||||
The following filter matches all user defined networks:
|
||||
|
||||
```bash
|
||||
```console
|
||||
$ docker network ls --filter type=custom
|
||||
NETWORK ID NAME DRIVER
|
||||
95e74588f40d foo bridge
|
||||
|
@ -160,7 +160,7 @@ NETWORK ID NAME DRIVER
|
|||
By having this flag it allows for batch cleanup. For example, use this filter
|
||||
to delete all user defined networks:
|
||||
|
||||
```bash
|
||||
```console
|
||||
$ docker network rm `docker network ls --filter type=custom -q`
|
||||
```
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@ Removes one or more networks by name or identifier. To remove a network,
|
|||
you must first disconnect any containers connected to it.
|
||||
To remove the network named 'my-network':
|
||||
|
||||
```bash
|
||||
```console
|
||||
$ docker network rm my-network
|
||||
```
|
||||
|
||||
|
@ -10,7 +10,7 @@ To delete multiple networks in a single `docker network rm` command, provide
|
|||
multiple network names or ids. The following example deletes a network with id
|
||||
`3695c422697f` and a network named `my-network`:
|
||||
|
||||
```bash
|
||||
```console
|
||||
$ docker network rm 3695c422697f my-network
|
||||
```
|
||||
|
||||
|
|
Loading…
Reference in New Issue