Browse code

Multiple fixes to the cli.md document.

*. Fixed headings so the side menu will now be consistent. Some sections
had H3s that were displaying and others did not leaving the left menu
very mismatched.

* Fixed several spelling errors.

* Re-formatted several long lines and badly laid out paragraphs.

* Fixed several double backticks.

* Added backticks to several outputs and variables.

* Removed two issues that are no longer valid.

* Removed several double spaces and extra lines.

Docker-DCO-1.1-Signed-off-by: James Turnbull <james@lovedthanlost.net> (github: jamtur01)

James Turnbull authored on 2014/10/03 23:38:22
Showing 1 changed files
... ...
@@ -88,7 +88,6 @@ expect an integer, and they can only be specified once.
88 88
       --tlsverify=false                          Use TLS and verify the remote (daemon: verify client, client: verify daemon)
89 89
       -v, --version=false                        Print version information and quit
90 90
 
91
-
92 91
 Options with [] may be specified multiple times.
93 92
 
94 93
 The Docker daemon is the persistent process that manages containers.
... ...
@@ -163,7 +162,7 @@ To stop a container, use `docker stop`.
163 163
 
164 164
 To kill the container, use `docker kill`.
165 165
 
166
-### Examples:
166
+#### Examples
167 167
 
168 168
     $ ID=$(sudo docker run -d ubuntu /usr/bin/top -b)
169 169
     $ sudo docker attach $ID
... ...
@@ -231,11 +230,12 @@ Exclusion patterns match files or directories relative to `PATH` that
231 231
 will be excluded from the context. Globbing is done using Go's
232 232
 [filepath.Match](http://golang.org/pkg/path/filepath#Match) rules.
233 233
 
234
-Please note that `.dockerignore` files in other subdirectories are considered as 
235
-normal files. Filepaths in .dockerignore are absolute with the current directory
236
-as the root. Wildcards are allowed but the search is not recursive.
234
+Please note that `.dockerignore` files in other subdirectories are
235
+considered as normal files. Filepaths in .dockerignore are absolute with
236
+the current directory as the root. Wildcards are allowed but the search
237
+is not recursive.
237 238
 
238
-### Example .dockerignore file 
239
+#### Example .dockerignore file
239 240
     */temp*
240 241
     */*/temp*
241 242
     temp?
... ...
@@ -256,7 +256,7 @@ See also:
256 256
 
257 257
 [*Dockerfile Reference*](/reference/builder).
258 258
 
259
-### Examples:
259
+#### Examples
260 260
 
261 261
     $ sudo docker build .
262 262
     Uploading context 10240 bytes
... ...
@@ -381,7 +381,7 @@ while the image is committed. This reduces the likelihood of
381 381
 encountering data corruption during the process of creating the commit.
382 382
 If this behavior is undesired, set the 'p' option to false.
383 383
 
384
-### Commit an existing container
384
+#### Commit an existing container
385 385
 
386 386
     $ sudo docker ps
387 387
     ID                  IMAGE               COMMAND             CREATED             STATUS              PORTS
... ...
@@ -457,7 +457,7 @@ container at any point.
457 457
 This is useful when you want to set up a container configuration ahead
458 458
 of time so that it is ready to start when you need it.
459 459
 
460
-### Example:
460
+#### Example
461 461
 
462 462
     $ sudo docker create -t -i fedora bash
463 463
     6d8af538ec541dd581ebc2a24153a28329acb5268abe5ef868c1f1a261221752
... ...
@@ -511,7 +511,7 @@ and Docker images will report:
511 511
 
512 512
     untag, delete
513 513
 
514
-### Examples
514
+#### Examples
515 515
 
516 516
 You'll need two shells for this example.
517 517
 
... ...
@@ -559,7 +559,7 @@ The `docker exec` command runs a new command in a running container.
559 559
 
560 560
 The `docker exec` command will typically be used after `docker run` or `docker start`.
561 561
 
562
-### Examples:
562
+#### Examples
563 563
 
564 564
     $ sudo docker run --name ubuntu_bash --rm -i -t ubuntu bash
565 565
 
... ...
@@ -623,7 +623,7 @@ decrease disk usage, and speed up `docker build` by
623 623
 allowing each step to be cached. These intermediate layers are not shown
624 624
 by default.
625 625
 
626
-### Listing the most recently created images
626
+#### Listing the most recently created images
627 627
 
628 628
     $ sudo docker images | head
629 629
     REPOSITORY                    TAG                 IMAGE ID            CREATED             VIRTUAL SIZE
... ...
@@ -637,7 +637,7 @@ by default.
637 637
     tryout                        latest              2629d1fa0b81        23 hours ago        131.5 MB
638 638
     <none>                        <none>              5ed6274db6ce        24 hours ago        1.089 GB
639 639
 
640
-### Listing the full length image IDs
640
+#### Listing the full length image IDs
641 641
 
642 642
     $ sudo docker images --no-trunc | head
643 643
     REPOSITORY                    TAG                 IMAGE ID                                                           CREATED             VIRTUAL SIZE
... ...
@@ -651,7 +651,7 @@ by default.
651 651
     tryout                        latest              2629d1fa0b81b222fca63371ca16cbf6a0772d07759ff80e8d1369b926940074   23 hours ago        131.5 MB
652 652
     <none>                        <none>              5ed6274db6ceb2397844896966ea239290555e74ef307030ebb01ff91b1914df   24 hours ago        1.089 GB
653 653
 
654
-### Filtering
654
+#### Filtering
655 655
 
656 656
 The filtering flag (`-f` or `--filter`) format is of "key=value". If there are more
657 657
 than one filter, then pass multiple flags (e.g., `--filter "foo=bar" --filter "bif=baz"`)
... ...
@@ -659,7 +659,7 @@ than one filter, then pass multiple flags (e.g., `--filter "foo=bar" --filter "b
659 659
 Current filters:
660 660
  * dangling (boolean - true or false)
661 661
 
662
-#### untagged images
662
+##### Untagged images
663 663
 
664 664
     $ sudo docker images --filter "dangling=true"
665 665
 
... ...
@@ -673,7 +673,7 @@ Current filters:
673 673
 
674 674
 This will display untagged images, that are the leaves of the images tree (not
675 675
 intermediary layers). These images occur when a new build of an image takes the
676
-repo:tag away from the IMAGE ID, leaving it untagged. A warning will be issued
676
+`repo:tag` away from the image ID, leaving it untagged. A warning will be issued
677 677
 if trying to remove an image when a container is presently using it.
678 678
 By having this flag it allows for batch cleanup.
679 679
 
... ...
@@ -690,7 +690,6 @@ Ready for use by `docker rmi ...`, like:
690 690
 
691 691
 NOTE: Docker will warn you if any containers exist that are using these untagged images.
692 692
 
693
-
694 693
 ## import
695 694
 
696 695
     Usage: docker import URL|- [REPOSITORY[:TAG]]
... ...
@@ -702,7 +701,7 @@ URLs must start with `http` and point to a single file archive (.tar,
702 702
 you would like to import from a local directory or archive, you can use
703 703
 the `-` parameter to take the data from `STDIN`.
704 704
 
705
-### Examples
705
+#### Examples
706 706
 
707 707
 **Import from a remote location:**
708 708
 
... ...
@@ -750,7 +749,7 @@ For example:
750 750
     Username: svendowideit
751 751
     Registry: [https://index.docker.io/v1/]
752 752
 
753
-The global `-D` option tells all `docker` comands to output debug information.
753
+The global `-D` option tells all `docker` commands to output debug information.
754 754
 
755 755
 When sending issue reports, please use `docker version` and `docker -D info` to
756 756
 ensure we know how your setup is configured.
... ...
@@ -769,9 +768,9 @@ specified, the given template will be executed for each result.
769 769
 Go's [text/template](http://golang.org/pkg/text/template/) package
770 770
 describes all the details of the format.
771 771
 
772
-### Examples
772
+#### Examples
773 773
 
774
-**Get an instance'sIP Address:**
774
+**Get an instance's IP address:**
775 775
 
776 776
 For the most part, you can pick out any field from the JSON in a fairly
777 777
 straightforward manner.
... ...
@@ -787,25 +786,22 @@ output:
787 787
 
788 788
 **Find a Specific Port Mapping:**
789 789
 
790
-The `.Field` syntax doesn't work when the field name
791
-begins with a number, but the template language's `index`
792
-function does. The `.NetworkSettings.Ports`
793
-section contains a map of the internal port mappings to a list
794
-of external address/port objects, so to grab just the numeric public
795
-port, you use `index` to find the specific port map,
796
-and then `index` 0 contains first object inside of
797
-that. Then we ask for the `HostPort` field to get
798
-the public address.
790
+The `.Field` syntax doesn't work when the field name begins with a
791
+number, but the template language's `index` function does. The
792
+`.NetworkSettings.Ports` section contains a map of the internal port
793
+mappings to a list of external address/port objects, so to grab just the
794
+numeric public port, you use `index` to find the specific port map, and
795
+then `index` 0 contains the first object inside of that. Then we ask for
796
+the `HostPort` field to get the public address.
799 797
 
800 798
     $ sudo docker inspect --format='{{(index (index .NetworkSettings.Ports "8787/tcp") 0).HostPort}}' $INSTANCE_ID
801 799
 
802 800
 **Get config:**
803 801
 
804
-The `.Field` syntax doesn't work when the field
805
-contains JSON data, but the template language's custom `json`
806
-function does. The `.config` section
807
-contains complex json object, so to grab it as JSON, you use
808
-`json` to convert config object into JSON
802
+The `.Field` syntax doesn't work when the field contains JSON data, but
803
+the template language's custom `json` function does. The `.config`
804
+section contains complex JSON object, so to grab it as JSON, you use
805
+`json` to convert the configuration object into JSON.
809 806
 
810 807
     $ sudo docker inspect --format='{{json .config}}' $INSTANCE_ID
811 808
 
... ...
@@ -856,8 +852,8 @@ Restores both images and tags.
856 856
       -p, --password=""    Password
857 857
       -u, --username=""    Username
858 858
 
859
-If you want to login to a self-hosted registry you can
860
-specify this by adding the server name.
859
+If you want to login to a self-hosted registry you can specify this by
860
+adding the server name.
861 861
 
862 862
     example:
863 863
     $ sudo docker login localhost:8080
... ...
@@ -961,16 +957,15 @@ Running `docker ps` showing 2 linked containers.
961 961
 `docker ps` will show only running containers by default. To see all containers:
962 962
 `docker ps -a`
963 963
 
964
-### Filtering
964
+#### Filtering
965 965
 
966
-The filtering flag (-f or --filter) format is a "key=value" pair. If there is more
966
+The filtering flag (`-f` or `--filter)` format is a `key=value` pair. If there is more
967 967
 than one filter, then pass multiple flags (e.g. `--filter "foo=bar" --filter "bif=baz"`)
968 968
 
969 969
 Current filters:
970 970
  * exited (int - the code of exited containers. Only useful with '--all')
971 971
 
972
-
973
-#### Successfully exited containers
972
+##### Successfully exited containers
974 973
 
975 974
     $ sudo docker ps -a --filter 'exited=0'
976 975
     CONTAINER ID        IMAGE             COMMAND                CREATED             STATUS                   PORTS                      NAMES
... ...
@@ -997,7 +992,7 @@ can `pull` and try without needing to define and configure your own.
997 997
 It is also possible to manually specify the path of a registry to pull from.
998 998
 For example, if you have set up a local registry, you can specify its path to
999 999
 pull from it. A repository path is similar to a URL, but does not contain
1000
-a protocol specifier (https://, for example).
1000
+a protocol specifier (`https://`, for example).
1001 1001
 
1002 1002
 To download a particular image, or set of images (i.e., a repository),
1003 1003
 use `docker pull`:
... ...
@@ -1044,13 +1039,7 @@ registry or to a self-hosted one.
1044 1044
       -l, --link=false       Remove the specified link and not the underlying container
1045 1045
       -v, --volumes=false    Remove the volumes associated with the container
1046 1046
 
1047
-### Known Issues (rm)
1048
-
1049
--   [Issue 197](https://github.com/docker/docker/issues/197) indicates
1050
-    that `docker kill` may leave directories behind
1051
-    and make it difficult to remove the container.
1052
-
1053
-### Examples:
1047
+#### Examples
1054 1048
 
1055 1049
     $ sudo docker rm /redis
1056 1050
     /redis
... ...
@@ -1061,21 +1050,19 @@ This will remove the container referenced under the link
1061 1061
     $ sudo docker rm --link /webapp/redis
1062 1062
     /webapp/redis
1063 1063
 
1064
-This will remove the underlying link between `/webapp`
1065
-and the `/redis` containers removing all
1066
-network communication.
1064
+This will remove the underlying link between `/webapp` and the `/redis`
1065
+containers removing all network communication.
1067 1066
 
1068 1067
     $ sudo docker rm --force redis
1069 1068
     redis
1070 1069
 
1071 1070
 The main process inside the container referenced under the link `/redis` will receive
1072
-SIGKILL, then the container will be removed.
1071
+`SIGKILL`, then the container will be removed.
1073 1072
 
1074
-
1075
-This command will delete all stopped containers. The command
1076
-`docker ps -a -q` will return all existing container
1077
-IDs and pass them to the `rm` command which will
1078
-delete them. Any running containers will not be deleted.
1073
+This command will delete all stopped containers. The command `docker ps
1074
+-a -q` will return all existing container IDs and pass them to the `rm`
1075
+command which will delete them. Any running containers will not be
1076
+deleted.
1079 1077
 
1080 1078
 ## rmi
1081 1079
 
... ...
@@ -1086,9 +1073,9 @@ delete them. Any running containers will not be deleted.
1086 1086
       -f, --force=false    Force removal of the image
1087 1087
       --no-prune=false     Do not delete untagged parents
1088 1088
 
1089
-### Removing tagged images
1089
+#### Removing tagged images
1090 1090
 
1091
-Images can be removed either by their short or long ID`s, or their image
1091
+Images can be removed either by their short or long IDs, or their image
1092 1092
 names. If an image has more than one name, each of them needs to be
1093 1093
 removed before the image is removed.
1094 1094
 
... ...
@@ -1174,14 +1161,7 @@ See the [Docker User Guide](/userguide/dockerlinks/) for more detailed
1174 1174
 information about the `--expose`, `-p`, `-P` and `--link` parameters,
1175 1175
 and linking containers.
1176 1176
 
1177
-### Known Issues (run –volumes-from)
1178
-
1179
-- [Issue 2702](https://github.com/docker/docker/issues/2702):
1180
-  "lxc-start: Permission denied - failed to mount" could indicate a
1181
-  permissions problem with AppArmor. Please see the issue for a
1182
-  workaround.
1183
-
1184
-### Examples:
1177
+#### Examples
1185 1178
 
1186 1179
     $ sudo docker run --cidfile /tmp/docker_test.cid ubuntu echo "test"
1187 1180
 
... ...
@@ -1234,7 +1214,7 @@ folder before starting your container.
1234 1234
 By bind-mounting the docker unix socket and statically linked docker
1235 1235
 binary (such as that provided by [https://get.docker.com](
1236 1236
 https://get.docker.com)), you give the container the full access to create and
1237
-manipulate the host's docker daemon.
1237
+manipulate the host's Docker daemon.
1238 1238
 
1239 1239
     $ sudo docker run -p 127.0.0.1:80:8080 ubuntu bash
1240 1240
 
... ...
@@ -1254,7 +1234,7 @@ ports in Docker.
1254 1254
 This sets environmental variables in the container. For illustration all three
1255 1255
 flags are shown here. Where `-e`, `--env` take an environment variable and
1256 1256
 value, or if no "=" is provided, then that variable's current value is passed
1257
-through (i.e. $MYVAR1 from the host is set to $MYVAR1 in the container). All
1257
+through (i.e. `$MYVAR1` from the host is set to `$MYVAR1` in the container). All
1258 1258
 three flags, `-e`, `--env` and `--env-file` can be repeated.
1259 1259
 
1260 1260
 Regardless of the order of these three flags, the `--env-file` are processed
... ...
@@ -1267,7 +1247,7 @@ override variables as needed.
1267 1267
     TEST_FOO=This is a test
1268 1268
 
1269 1269
 The `--env-file` flag takes a filename as an argument and expects each line
1270
-to be in the VAR=VAL format, mimicking the argument passed to `--env`. Comment
1270
+to be in the `VAR=VAL` format, mimicking the argument passed to `--env`. Comment
1271 1271
 lines need only be prefixed with `#`
1272 1272
 
1273 1273
 An example of a file passed with `--env-file`
... ...
@@ -1339,14 +1319,13 @@ retrieve the container's ID once the container has finished running.
1339 1339
    brw-rw---- 1 root disk 8, 3 Feb  9 16:05 /dev/sdd
1340 1340
    crw-rw-rw- 1 root root 1, 5 Feb  9 16:05 /dev/nulo
1341 1341
 
1342
-It is often necessary to directly expose devices to a container.  ``--device``
1342
+It is often necessary to directly expose devices to a container. The `--device`
1343 1343
 option enables that.  For example, a specific block storage device or loop
1344 1344
 device or audio device can be added to an otherwise unprivileged container
1345
-(without the ``--privileged`` flag) and have the application directly access it.
1346
-
1347
-** Security note: **
1345
+(without the `--privileged` flag) and have the application directly access it.
1348 1346
 
1349
-``--device`` cannot be safely used with ephemeral devices.  Block devices that may be removed should not be added to untrusted containers with ``--device``!
1347
+**Note:**
1348
+> `--device` cannot be safely used with ephemeral devices. Block devices that may be removed should not be added to untrusted containers with `--device`.
1350 1349
 
1351 1350
 **A complete example:**
1352 1351
 
... ...
@@ -1356,7 +1335,7 @@ device or audio device can be added to an otherwise unprivileged container
1356 1356
     $ sudo docker run -d -p 1443:443 --dns=10.0.0.1 --dns-search=dev.org -v /var/log/httpd --volumes-from static --link riak --link app -h www.sven.dev.org --name web webserver
1357 1357
     $ sudo docker run -t -i --rm --volumes-from web -w /var/log/httpd busybox tail -f access.log
1358 1358
 
1359
-This example shows 5 containers that might be set up to test a web
1359
+This example shows five containers that might be set up to test a web
1360 1360
 application change:
1361 1361
 
1362 1362
 1. Start a pre-prepared volume image `static-web-files` (in the background)
... ...
@@ -1390,8 +1369,9 @@ how a container should or should not be restarted on exit.
1390 1390
 
1391 1391
 ** always ** - Always restart the container reguardless of the exit status.
1392 1392
 
1393
-You can also specify the maximum amount of times Docker will try to restart the
1394
-container when using the ** on-failure ** policy.  The default is that Docker will try forever to restart the container.
1393
+You can also specify the maximum amount of times Docker will try to
1394
+restart the container when using the ** on-failure ** policy.  The
1395
+default is that Docker will try forever to restart the container.
1395 1396
 
1396 1397
     $ sudo docker run --restart=always redis
1397 1398
 
... ...
@@ -1400,10 +1380,11 @@ the container exits, Docker will restart it.
1400 1400
 
1401 1401
     $ sudo docker run --restart=on-failure:10 redis
1402 1402
 
1403
-This will run the `redis` container with a restart policy of ** on-failure ** and a
1404
-maximum restart count of 10.  If the `redis` container exits with a non-zero exit
1405
-status more than 10 times in a row Docker will abort trying to restart the container.
1406
-Providing a maximum restart limit is only valid for the ** on-failure ** policy.
1403
+This will run the `redis` container with a restart policy of **
1404
+on-failure ** and a maximum restart count of 10.  If the `redis`
1405
+container exits with a non-zero exit status more than 10 times in a row
1406
+Docker will abort trying to restart the container.  Providing a maximum
1407
+restart limit is only valid for the ** on-failure ** policy.
1407 1408
 
1408 1409
 ## save
1409 1410
 
... ...
@@ -1414,10 +1395,10 @@ Providing a maximum restart limit is only valid for the ** on-failure ** policy.
1414 1414
       -o, --output=""    Write to a file, instead of STDOUT
1415 1415
 
1416 1416
 Produces a tarred repository to the standard output stream.
1417
-Contains all parent layers, and all tags + versions, or specified repo:tag, for
1417
+Contains all parent layers, and all tags + versions, or specified `repo:tag`, for
1418 1418
 each argument provided.
1419 1419
 
1420
-It is used to create a backup that can then be used with ``docker load``
1420
+It is used to create a backup that can then be used with `docker load`
1421 1421
 
1422 1422
     $ sudo docker save busybox > busybox.tar
1423 1423
     $ ls -sh busybox.tar
... ...
@@ -1454,8 +1435,8 @@ more details on finding shared images from the command line.
1454 1454
 
1455 1455
     Restart a stopped container
1456 1456
 
1457
-      -a, --attach=false         Attach container's STDOUT and STDERR and forward all signals to the process
1458
-      -i, --interactive=false    Attach container's STDIN
1457
+      -a, --attach=false         Attach container's `STDOUT` and `STDERR` and forward all signals to the process
1458
+      -i, --interactive=false    Attach container's `STDIN`
1459 1459
 
1460 1460
 When run on a container that has already been started,
1461 1461
 takes no action and succeeds unconditionally.
... ...
@@ -1464,12 +1445,12 @@ takes no action and succeeds unconditionally.
1464 1464
 
1465 1465
     Usage: docker stop [OPTIONS] CONTAINER [CONTAINER...]
1466 1466
 
1467
-    Stop a running container by sending SIGTERM and then SIGKILL after a grace period
1467
+    Stop a running container by sending `SIGTERM` and then `SIGKILL` after a grace period
1468 1468
 
1469 1469
       -t, --time=10      Number of seconds to wait for the container to stop before killing it. Default is 10 seconds.
1470 1470
 
1471
-The main process inside the container will receive SIGTERM, and after a
1472
-grace period, SIGKILL
1471
+The main process inside the container will receive `SIGTERM`, and after a
1472
+grace period, `SIGKILL`.
1473 1473
 
1474 1474
 ## tag
1475 1475