Browse code

Merge pull request #28734 from ipbabble/master

Added and example of using --format with docker images

Vincent Demeester authored on 2016/11/29 04:57:13
Showing 1 changed files
... ...
@@ -103,6 +103,43 @@ which displayed different visualizations of the image data. Docker core removed
103 103
 this functionality in the 1.7 version. If you liked this functionality, you can
104 104
 still find it in the third-party dockviz tool: https://github.com/justone/dockviz.
105 105
 
106
+## Listing images in a desired format
107
+
108
+When using the --format option, the image command will either output the data 
109
+exactly as the template declares or, when using the `table` directive, will 
110
+include column headers as well. You can use special characters like `\t` for
111
+inserting tab spacing between columns. 
112
+
113
+The following example uses a template without headers and outputs the ID and 
114
+Repository entries separated by a colon for all images:
115
+
116
+    docker images --format "{{.ID}}: {{.Repository}}"
117
+    77af4d6b9913: <none>
118
+    b6fa739cedf5: committ
119
+    78a85c484bad: ipbabble
120
+    30557a29d5ab: docker
121
+    5ed6274db6ce: <none>
122
+    746b819f315e: postgres
123
+    746b819f315e: postgres
124
+    746b819f315e: postgres
125
+    746b819f315e: postgres
126
+
127
+To list all images with their repository and tag in a table format you can use:
128
+
129
+    docker images --format "table {{.ID}}\t{{.Repository}}\t{{.Tag}}"
130
+    IMAGE ID            REPOSITORY                TAG
131
+    77af4d6b9913        <none>                    <none>
132
+    b6fa739cedf5        committ                   latest
133
+    78a85c484bad        ipbabble                  <none>
134
+    30557a29d5ab        docker                    latest
135
+    5ed6274db6ce        <none>                    <none>
136
+    746b819f315e        postgres                  9
137
+    746b819f315e        postgres                  9.3
138
+    746b819f315e        postgres                  9.3.5
139
+    746b819f315e        postgres                  latest
140
+
141
+Valid template placeholders are listed above.
142
+
106 143
 ## Listing only the shortened image IDs
107 144
 
108 145
 Listing just the shortened image IDs. This can be useful for some automated