Browse code

Numerous small fixes to the CLI documentation

James Turnbull authored on 2013/12/31 03:36:52
Showing 1 changed files
... ...
@@ -43,14 +43,14 @@ To list available commands, either run ``docker`` with no parameters or execute
43 43
       -s="": Force the docker runtime to use a specific storage driver
44 44
       -v=false: Print version information and quit
45 45
 
46
-The docker daemon is the persistent process that manages containers.  Docker uses the same binary for both the 
46
+The Docker daemon is the persistent process that manages containers.  Docker uses the same binary for both the 
47 47
 daemon and client.  To run the daemon you provide the ``-d`` flag.
48 48
 
49
-To force docker to use devicemapper as the storage driver, use ``docker -d -s devicemapper``
49
+To force Docker to use devicemapper as the storage driver, use ``docker -d -s devicemapper``.
50 50
 
51
-To set the dns server for all docker containers, use ``docker -d -dns 8.8.8.8``
51
+To set the DNS server for all Docker containers, use ``docker -d -dns 8.8.8.8``.
52 52
 
53
-To run the daemon with debug output, use ``docker -d -D``
53
+To run the daemon with debug output, use ``docker -d -D``.
54 54
 
55 55
 .. _cli_attach:
56 56
 
... ...
@@ -69,11 +69,11 @@ To run the daemon with debug output, use ``docker -d -D``
69 69
 You can detach from the container again (and leave it running) with
70 70
 ``CTRL-c`` (for a quiet exit) or ``CTRL-\`` to get a stacktrace of
71 71
 the Docker client when it quits.  When you detach from the container's 
72
-process the exit code will be retuned to the client.
72
+process the exit code will be returned to the client.
73 73
 
74
-To stop a container, use ``docker stop``
74
+To stop a container, use ``docker stop``.
75 75
 
76
-To kill the container, use ``docker kill``
76
+To kill the container, use ``docker kill``.
77 77
 
78 78
 .. _cli_attach_examples:
79 79
 
... ...
@@ -129,12 +129,11 @@ Examples:
129 129
       -no-cache: Do not use the cache when building the image.
130 130
       -rm: Remove intermediate containers after a successful build
131 131
 
132
-The files at PATH or URL are called the "context" of the build. The
133
-build process may refer to any of the files in the context, for
134
-example when using an :ref:`ADD <dockerfile_add>` instruction.  When a
135
-single ``Dockerfile`` is given as URL, then no context is set.  When a
136
-git repository is set as URL, then the repository is used as the
137
-context
132
+The files at ``PATH`` or ``URL`` are called the "context" of the build. The
133
+build process may refer to any of the files in the context, for example when
134
+using an :ref:`ADD <dockerfile_add>` instruction.  When a single ``Dockerfile``
135
+is given as ``URL``, then no context is set.  When a Git repository is set as
136
+``URL``, then the repository is used as the context
138 137
 
139 138
 .. _cli_build_examples:
140 139
 
... ...
@@ -169,13 +168,13 @@ Examples:
169 169
      ---> f52f38b7823e
170 170
     Successfully built f52f38b7823e
171 171
 
172
-This example specifies that the PATH is ``.``, and so all the files in
173
-the local directory get tar'd and sent to the Docker daemon.  The PATH
172
+This example specifies that the ``PATH`` is ``.``, and so all the files in
173
+the local directory get tar'd and sent to the Docker daemon.  The ``PATH``
174 174
 specifies where to find the files for the "context" of the build on
175 175
 the Docker daemon. Remember that the daemon could be running on a
176
-remote machine and that no parsing of the Dockerfile happens at the
176
+remote machine and that no parsing of the ``Dockerfile`` happens at the
177 177
 client side (where you're running ``docker build``). That means that
178
-*all* the files at PATH get sent, not just the ones listed to
178
+*all* the files at ``PATH`` get sent, not just the ones listed to
179 179
 :ref:`ADD <dockerfile_add>` in the ``Dockerfile``.
180 180
 
181 181
 The transfer of context from the local machine to the Docker daemon is
... ...
@@ -198,16 +197,16 @@ tag will be ``2.0``
198 198
 
199 199
 This will read a ``Dockerfile`` from *stdin* without context. Due to
200 200
 the lack of a context, no contents of any local directory will be sent
201
-to the ``docker`` daemon.  Since there is no context, a Dockerfile
201
+to the ``docker`` daemon.  Since there is no context, a ``Dockerfile``
202 202
 ``ADD`` only works if it refers to a remote URL.
203 203
 
204 204
 .. code-block:: bash
205 205
 
206 206
     $ sudo docker build github.com/creack/docker-firefox
207 207
 
208
-This will clone the Github repository and use the cloned repository as
208
+This will clone the GitHub repository and use the cloned repository as
209 209
 context. The ``Dockerfile`` at the root of the repository is used as
210
-``Dockerfile``.  Note that you can specify an arbitrary git repository
210
+``Dockerfile``.  Note that you can specify an arbitrary Git repository
211 211
 by using the ``git://`` schema.
212 212
 
213 213
 
... ...
@@ -248,7 +247,7 @@ Change the command that a container runs
248 248
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
249 249
 
250 250
 Sometimes you have an application container running just a service and you need
251
-to make a quick change (run bash?) and then change it back.
251
+to make a quick change and then change it back.
252 252
 
253 253
 In this example, we run a container with ``ls`` and then change the image to
254 254
 run ``ls /etc``.
... ...
@@ -271,9 +270,9 @@ Full -run example
271 271
 The ``-run`` JSON hash changes the ``Config`` section when running ``docker inspect CONTAINERID``
272 272
 or ``config`` when running ``docker inspect IMAGEID``.
273 273
 
274
-(multiline is ok within a single quote ``'``)
274
+(Multiline is okay within a single quote ``'``)
275 275
 
276
-::
276
+.. code-block:: bash
277 277
 
278 278
   $ sudo docker commit -run='
279 279
   {
... ...
@@ -316,7 +315,7 @@ or ``config`` when running ``docker inspect IMAGEID``.
316 316
 
317 317
     Copy files/folders from the containers filesystem to the host
318 318
     path.  Paths are relative to the root of the filesystem.
319
-    
319
+
320 320
 .. code-block:: bash
321 321
 
322 322
     $ sudo docker cp 7bb0e258aefe:/etc/debian_version .
... ...
@@ -330,7 +329,7 @@ or ``config`` when running ``docker inspect IMAGEID``.
330 330
 ::
331 331
 
332 332
     Usage: docker diff CONTAINER
333
- 
333
+
334 334
     List the changed files and directories in a container's filesystem
335 335
 
336 336
 There are 3 events that are listed in the 'diff':
... ...
@@ -339,7 +338,7 @@ There are 3 events that are listed in the 'diff':
339 339
 2. ```D``` - Delete
340 340
 3. ```C``` - Change
341 341
 
342
-for example:
342
+For example:
343 343
 
344 344
 .. code-block:: bash
345 345
 
... ...
@@ -367,7 +366,7 @@ for example:
367 367
     Usage: docker events
368 368
 
369 369
     Get real time events from the server
370
-    
370
+
371 371
     -since="": Show previously created events and then stream.
372 372
                (either seconds since epoch, or date string as below)
373 373
 
... ...
@@ -430,8 +429,8 @@ Show events in the past from a specified time
430 430
     Usage: docker export CONTAINER
431 431
 
432 432
     Export the contents of a filesystem as a tar archive to STDOUT
433
-    
434
-for example:
433
+
434
+For example:
435 435
 
436 436
 .. code-block:: bash
437 437
 
... ...
@@ -451,7 +450,7 @@ for example:
451 451
       -notrunc=false: Don't truncate output
452 452
       -q=false: only show numeric IDs
453 453
 
454
-To see how the docker:latest image was built:
454
+To see how the ``docker:latest`` image was built:
455 455
 
456 456
 .. code-block:: bash
457 457
 
... ...
@@ -483,7 +482,7 @@ To see how the docker:latest image was built:
483 483
 	d5e85dc5b1d8        2 weeks ago         /bin/sh -c apt-get update
484 484
 	13e642467c11        2 weeks ago         /bin/sh -c echo 'deb http://archive.ubuntu.com/ubuntu precise main universe' > /etc/apt/sources.list
485 485
 	ae6dde92a94e        2 weeks ago         /bin/sh -c #(nop) MAINTAINER Solomon Hykes <solomon@dotcloud.com>
486
-	ubuntu:12.04        6 months ago 
486
+	ubuntu:12.04        6 months ago
487 487
 
488 488
 .. _cli_images:
489 489
 
... ...
@@ -501,7 +500,7 @@ To see how the docker:latest image was built:
501 501
       -q=false: only show numeric IDs
502 502
       -tree=false: output graph in tree format
503 503
       -viz=false: output graph in graphviz format
504
-      
504
+
505 505
 Listing the most recently created images
506 506
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
507 507
 
... ...
@@ -589,10 +588,9 @@ Displaying image hierarchy
589 589
     (.tar, .tar.gz, .tgz, .bzip, .tar.xz, .txz) into it, then optionally tag it.
590 590
 
591 591
 At this time, the URL must start with ``http`` and point to a single
592
-file archive (.tar, .tar.gz, .tgz, .bzip, .tar.xz, .txz) containing a
592
+file archive (.tar, .tar.gz, .tgz, .bzip, .tar.xz, or .txz) containing a
593 593
 root filesystem. If you would like to import from a local directory or
594
-archive, you can use the ``-`` parameter to take the data from
595
-standard in.
594
+archive, you can use the ``-`` parameter to take the data from *stdin*.
596 595
 
597 596
 Examples
598 597
 ~~~~~~~~
... ...
@@ -602,24 +600,30 @@ Import from a remote location
602 602
 
603 603
 This will create a new untagged image.
604 604
 
605
-``$ sudo docker import http://example.com/exampleimage.tgz``
605
+.. code-block:: bash
606
+
607
+    $ sudo docker import http://example.com/exampleimage.tgz
606 608
 
607 609
 Import from a local file
608 610
 ........................
609 611
 
610
-Import to docker via pipe and standard in
612
+Import to docker via pipe and *stdin*.
613
+
614
+.. code-block:: bash
611 615
 
612
-``$ cat exampleimage.tgz | sudo docker import - exampleimagelocal:new``
616
+    $ cat exampleimage.tgz | sudo docker import - exampleimagelocal:new
613 617
 
614 618
 Import from a local directory
615 619
 .............................
616 620
 
617
-``$ sudo tar -c . | docker import - exampleimagedir``
621
+.. code-block:: bash
622
+
623
+    $ sudo tar -c . | docker import - exampleimagedir
618 624
 
619
-Note the ``sudo`` in this example -- you must preserve the ownership
620
-of the files (especially root ownership) during the archiving with
621
-tar. If you are not root (or sudo) when you tar, then the ownerships
622
-might not get preserved.
625
+Note the ``sudo`` in this example -- you must preserve the ownership of the
626
+files (especially root ownership) during the archiving with tar. If you are not
627
+root (or the sudo command) when you tar, then the ownerships might not get
628
+preserved.
623 629
 
624 630
 .. _cli_info:
625 631
 
... ...
@@ -658,16 +662,16 @@ might not get preserved.
658 658
 
659 659
     Insert a file from URL in the IMAGE at PATH
660 660
 
661
-Use the specified IMAGE as the parent for a new image which adds a
662
-:ref:`layer <layer_def>` containing the new file. ``insert`` does not modify 
663
-the original image, and the new image has the contents of the parent image, 
664
-plus the new file.
661
+Use the specified ``IMAGE`` as the parent for a new image which adds a
662
+:ref:`layer <layer_def>` containing the new file. The ``insert`` command does
663
+not modify the original image, and the new image has the contents of the parent
664
+image, plus the new file.
665 665
 
666 666
 
667 667
 Examples
668 668
 ~~~~~~~~
669 669
 
670
-Insert file from github
670
+Insert file from GitHub
671 671
 .......................
672 672
 
673 673
 .. code-block:: bash
... ...
@@ -691,7 +695,7 @@ Insert file from github
691 691
 By default, this will render all results in a JSON array.  If a format
692 692
 is specified, the given template will be executed for each result.
693 693
 
694
-Go's `text/template <http://golang.org/pkg/text/template/>` package
694
+Go's `text/template <http://golang.org/pkg/text/template/>`_ package
695 695
 describes all the details of the format.
696 696
 
697 697
 Examples
... ...
@@ -796,14 +800,14 @@ Known Issues (kill)
796 796
 
797 797
     Fetch the logs of a container
798 798
 
799
-``docker logs`` is a convenience which batch-retrieves whatever logs
800
-are present at the time of execution. This does not guarantee
801
-execution order when combined with a ``docker run`` (i.e. your run may
802
-not have generated any logs at the time you execute ``docker logs``).
799
+The ``docker logs`` command is a convenience which batch-retrieves whatever
800
+logs are present at the time of execution. This does not guarantee execution
801
+order when combined with a ``docker run`` (i.e. your run may not have generated
802
+any logs at the time you execute ``docker logs``).
803 803
 
804
-``docker logs -f`` combines ``docker logs`` and ``docker attach``: it
805
-will first return all logs from the beginning and then continue
806
-streaming new output from the container's stdout and stderr.
804
+The ``docker logs -f`` command combines ``docker logs`` and ``docker attach``:
805
+it will first return all logs from the beginning and then continue streaming
806
+new output from the container's stdout and stderr.
807 807
 
808 808
 
809 809
 .. _cli_port:
... ...
@@ -941,7 +945,7 @@ Removing tagged images
941 941
 ~~~~~~~~~~~~~~~~~~~~~~
942 942
 
943 943
 Images can be removed either by their short or long ID's, or their image names.
944
-If an image has more than one name, each of them needs to be removed before the 
944
+If an image has more than one name, each of them needs to be removed before the
945 945
 image is removed.
946 946
 
947 947
 .. code-block:: bash
... ...
@@ -1005,13 +1009,14 @@ image is removed.
1005 1005
       -link="": Add link to another container (name:alias)
1006 1006
       -name="": Assign the specified name to the container. If no name is specific docker will generate a random name
1007 1007
       -P=false: Publish all exposed ports to the host interfaces
1008
-      
1009
-``'docker run'`` first ``'creates'`` a writeable container layer over
1010
-the specified image, and then ``'starts'`` it using the specified
1011
-command. That is, ``'docker run'`` is equivalent to the API
1012
-``/containers/create`` then ``/containers/(id)/start``.
1013 1008
 
1014
-``docker run`` can be used in combination with ``docker commit`` to :ref:`change the command that a container runs <cli_commit_examples>`.
1009
+The ``docker run`` command first ``creates`` a writeable container layer over
1010
+the specified image, and then ``starts`` it using the specified command. That
1011
+is, ``docker run`` is equivalent to the API ``/containers/create`` then
1012
+``/containers/(id)/start``.
1013
+
1014
+The ``docker run`` command can be used in combination with ``docker commit`` to
1015
+:ref:`change the command that a container runs <cli_commit_examples>`.
1015 1016
 
1016 1017
 Known Issues (run -volumes-from)
1017 1018
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
... ...
@@ -1027,10 +1032,10 @@ Examples:
1027 1027
 
1028 1028
     $ sudo docker run -cidfile /tmp/docker_test.cid ubuntu echo "test"
1029 1029
 
1030
-This will create a container and print "test" to the console. The
1031
-``cidfile`` flag makes docker attempt to create a new file and write the
1032
-container ID to it. If the file exists already, docker will return an
1033
-error. Docker will close this file when docker run exits.
1030
+This will create a container and print ``test`` to the console. The
1031
+``cidfile`` flag makes Docker attempt to create a new file and write the
1032
+container ID to it. If the file exists already, Docker will return an
1033
+error. Docker will close this file when ``docker run`` exits.
1034 1034
 
1035 1035
 .. code-block:: bash
1036 1036
 
... ...
@@ -1064,7 +1069,7 @@ use-cases, like running Docker within Docker.
1064 1064
    $ sudo docker  run -w /path/to/dir/ -i -t  ubuntu pwd
1065 1065
 
1066 1066
 The ``-w`` lets the command being executed inside directory given,
1067
-here /path/to/dir/. If the path does not exists it is created inside the
1067
+here ``/path/to/dir/``. If the path does not exists it is created inside the
1068 1068
 container.
1069 1069
 
1070 1070
 .. code-block:: bash
... ...
@@ -1081,7 +1086,7 @@ using the container, but inside the current working directory.
1081 1081
 
1082 1082
    $ sudo docker run -p 127.0.0.1:80:8080 ubuntu bash
1083 1083
 
1084
-This binds port ``8080`` of the container to port ``80`` on 127.0.0.1 of the
1084
+This binds port ``8080`` of the container to port ``80`` on ``127.0.0.1`` of the
1085 1085
 host machine. :ref:`port_redirection` explains in detail how to manipulate ports
1086 1086
 in Docker.
1087 1087
 
... ...
@@ -1115,11 +1120,11 @@ to the newly created container.
1115 1115
    $ sudo docker run -volumes-from 777f7dc92da7,ba8c0c54f0f2:ro -i -t ubuntu pwd
1116 1116
 
1117 1117
 The ``-volumes-from`` flag mounts all the defined volumes from the
1118
-refrence containers. Containers can be specified by a comma seperated
1118
+referenced containers. Containers can be specified by a comma seperated
1119 1119
 list or by repetitions of the ``-volumes-from`` argument. The container
1120
-id may be optionally suffixed with ``:ro`` or ``:rw`` to mount the volumes in
1120
+ID may be optionally suffixed with ``:ro`` or ``:rw`` to mount the volumes in
1121 1121
 read-only or read-write mode, respectively. By default, the volumes are mounted
1122
-in the same mode (rw or ro) as the reference container.
1122
+in the same mode (read write or read only) as the reference container.
1123 1123
 
1124 1124
 A complete example
1125 1125
 ..................
... ...
@@ -1134,10 +1139,10 @@ A complete example
1134 1134
 
1135 1135
 This example shows 5 containers that might be set up to test a web application change:
1136 1136
 
1137
-1. Start a pre-prepared volume image ``static-web-files`` (in the background) that has css, image and static html in it, (with a VOLUME statement in the Dockerfile to allow the web server to use those files);
1138
-2. Start a pre-prepared ``riakserver`` image, give the container name ``riak`` and expose 8098 to any containers that link to it;
1137
+1. Start a pre-prepared volume image ``static-web-files`` (in the background) that has CSS, image and static HTML in it, (with a ``VOLUME`` instruction in the ``Dockerfile`` to allow the web server to use those files);
1138
+2. Start a pre-prepared ``riakserver`` image, give the container name ``riak`` and expose port ``8098`` to any containers that link to it;
1139 1139
 3. Start the ``appserver`` image, restricting its memory usage to 100MB, setting two environment variables ``DEVELOPMENT`` and ``BRANCH`` and bind-mounting the current directory (``$(pwd)``) in the container in read-only mode as ``/app/bin``;
1140
-4. Start the ``webserver``, mapping port 443 (https) in the container to port 1443 on the docker server, setting the dns server to ``dns.dev.org``, creating a volume to put the log files into (so we can access it from another container), then importing the files from the volume exposed by the ``static`` container, and linking to all exposed ports from ``riak`` and ``app``. Lastly, we set the hostname to ``web.sven.dev.org`` so its consistent with the pre-generated ssl certificate;
1140
+4. Start the ``webserver``, mapping port ``443`` in the container to port ``1443`` on the Docker server, setting the DNS server to ``dns.dev.org``, creating a volume to put the log files into (so we can access it from another container), then importing the files from the volume exposed by the ``static`` container, and linking to all exposed ports from ``riak`` and ``app``. Lastly, we set the hostname to ``web.sven.dev.org`` so its consistent with the pre-generated SSL certificate;
1141 1141
 5. Finally, we create a container that runs ``tail -f access.log`` using the logs volume from the ``web`` container, setting the workdir to ``/var/log/httpd``. The ``-rm`` option means that when the container exits, the container's layer is removed.
1142 1142
 
1143 1143
 
... ...
@@ -1226,7 +1231,7 @@ The main process inside the container will receive SIGTERM, and after a grace pe
1226 1226
 ``version``
1227 1227
 -----------
1228 1228
 
1229
-Show the version of the docker client, daemon, and latest released version.
1229
+Show the version of the Docker client, daemon, and latest released version.
1230 1230
 
1231 1231
 
1232 1232
 .. _cli_wait: