Преглед на файлове

Added and example of using --format with docker images

Docker-DCO-1.1-Signed-off-by: William Henry <whenry@redhat.com> (github: ipbabble)

Signed-off-by: William Henry <whenry@redhat.com>
William Henry преди 8 години
родител
ревизия
798c00a7ee
променени са 1 файла, в които са добавени 37 реда и са изтрити 0 реда
  1. 37 0
      man/docker-images.1.md

+ 37 - 0
man/docker-images.1.md

@@ -103,6 +103,43 @@ which displayed different visualizations of the image data. Docker core removed
 this functionality in the 1.7 version. If you liked this functionality, you can
 this functionality in the 1.7 version. If you liked this functionality, you can
 still find it in the third-party dockviz tool: https://github.com/justone/dockviz.
 still find it in the third-party dockviz tool: https://github.com/justone/dockviz.
 
 
+## Listing images in a desired format
+
+When using the --format option, the image command will either output the data 
+exactly as the template declares or, when using the `table` directive, will 
+include column headers as well. You can use special characters like `\t` for
+inserting tab spacing between columns. 
+
+The following example uses a template without headers and outputs the ID and 
+Repository entries separated by a colon for all images:
+
+    docker images --format "{{.ID}}: {{.Repository}}"
+    77af4d6b9913: <none>
+    b6fa739cedf5: committ
+    78a85c484bad: ipbabble
+    30557a29d5ab: docker
+    5ed6274db6ce: <none>
+    746b819f315e: postgres
+    746b819f315e: postgres
+    746b819f315e: postgres
+    746b819f315e: postgres
+
+To list all images with their repository and tag in a table format you can use:
+
+    docker images --format "table {{.ID}}\t{{.Repository}}\t{{.Tag}}"
+    IMAGE ID            REPOSITORY                TAG
+    77af4d6b9913        <none>                    <none>
+    b6fa739cedf5        committ                   latest
+    78a85c484bad        ipbabble                  <none>
+    30557a29d5ab        docker                    latest
+    5ed6274db6ce        <none>                    <none>
+    746b819f315e        postgres                  9
+    746b819f315e        postgres                  9.3
+    746b819f315e        postgres                  9.3.5
+    746b819f315e        postgres                  latest
+
+Valid template placeholders are listed above.
+
 ## Listing only the shortened image IDs
 ## Listing only the shortened image IDs
 
 
 Listing just the shortened image IDs. This can be useful for some automated
 Listing just the shortened image IDs. This can be useful for some automated