Browse code

Document Healthcheck in image spec

Signed-off-by: Thomas Leonard <thomas.leonard@docker.com>

Thomas Leonard authored on 2016/08/16 01:01:55
Showing 1 changed files
1 1
new file mode 100644
... ...
@@ -0,0 +1,696 @@
0
+# Docker Image Specification v1.2.0
1
+
2
+An *Image* is an ordered collection of root filesystem changes and the
3
+corresponding execution parameters for use within a container runtime. This
4
+specification outlines the format of these filesystem changes and corresponding
5
+parameters and describes how to create and use them for use with a container
6
+runtime and execution tool.
7
+
8
+This version of the image specification was adopted starting in Docker 1.12.
9
+
10
+## Terminology
11
+
12
+This specification uses the following terms:
13
+
14
+<dl>
15
+    <dt>
16
+        Layer
17
+    </dt>
18
+    <dd>
19
+        Images are composed of <i>layers</i>. Each layer is a set of filesystem
20
+        changes. Layers do not have configuration metadata such as environment
21
+        variables or default arguments - these are properties of the image as a
22
+        whole rather than any particular layer.
23
+    </dd>
24
+    <dt>
25
+        Image JSON
26
+    </dt>
27
+    <dd>
28
+        Each image has an associated JSON structure which describes some
29
+        basic information about the image such as date created, author, and the
30
+        ID of its parent image as well as execution/runtime configuration like
31
+        its entry point, default arguments, CPU/memory shares, networking, and
32
+        volumes. The JSON structure also references a cryptographic hash of
33
+        each layer used by the image, and provides history information for
34
+        those layers. This JSON is considered to be immutable, because changing
35
+        it would change the computed ImageID. Changing it means creating a new
36
+        derived image, instead of changing the existing image.
37
+    </dd>
38
+    <dt>
39
+        Image Filesystem Changeset
40
+    </dt>
41
+    <dd>
42
+        Each layer has an archive of the files which have been added, changed,
43
+        or deleted relative to its parent layer. Using a layer-based or union
44
+        filesystem such as AUFS, or by computing the diff from filesystem
45
+        snapshots, the filesystem changeset can be used to present a series of
46
+        image layers as if they were one cohesive filesystem.
47
+    </dd>
48
+    <dt>
49
+        Layer DiffID
50
+    </dt>
51
+    <dd>
52
+        Layers are referenced by cryptographic hashes of their serialized
53
+        representation. This is a SHA256 digest over the tar archive used to
54
+        transport the layer, represented as a hexadecimal encoding of 256 bits, e.g.,
55
+        <code>sha256:a9561eb1b190625c9adb5a9513e72c4dedafc1cb2d4c5236c9a6957ec7dfd5a9</code>.
56
+        Layers must be packed and unpacked reproducibly to avoid changing the
57
+        layer ID, for example by using tar-split to save the tar headers. Note
58
+        that the digest used as the layer ID is taken over an uncompressed
59
+        version of the tar.
60
+    </dd>
61
+    <dt>
62
+        Layer ChainID
63
+    </dt>
64
+    <dd>
65
+        For convenience, it is sometimes useful to refer to a stack of layers
66
+        with a single identifier. This is called a <code>ChainID</code>. For a
67
+        single layer (or the layer at the bottom of a stack), the
68
+        <code>ChainID</code> is equal to the layer's <code>DiffID</code>.
69
+        Otherwise the <code>ChainID</code> is given by the formula:
70
+        <code>ChainID(layerN) = SHA256hex(ChainID(layerN-1) + " " + DiffID(layerN))</code>.
71
+    </dd>
72
+    <dt>
73
+        ImageID <a name="id_desc"></a>
74
+    </dt>
75
+    <dd>
76
+        Each image's ID is given by the SHA256 hash of its configuration JSON. It is 
77
+        represented as a hexadecimal encoding of 256 bits, e.g.,
78
+        <code>sha256:a9561eb1b190625c9adb5a9513e72c4dedafc1cb2d4c5236c9a6957ec7dfd5a9</code>.
79
+        Since the configuration JSON that gets hashed references hashes of each
80
+        layer in the image, this formulation of the ImageID makes images
81
+        content-addresable.
82
+    </dd>
83
+    <dt>
84
+        Tag
85
+    </dt>
86
+    <dd>
87
+        A tag serves to map a descriptive, user-given name to any single image
88
+        ID. Tag values are limited to the set of characters
89
+        <code>[a-zA-Z0-9_.-]</code>, except they may not start with a <code>.</code>
90
+        or <code>-</code> character. Tags are limited to 127 characters.
91
+    </dd>
92
+    <dt>
93
+        Repository
94
+    </dt>
95
+    <dd>
96
+        A collection of tags grouped under a common prefix (the name component
97
+        before <code>:</code>). For example, in an image tagged with the name
98
+        <code>my-app:3.1.4</code>, <code>my-app</code> is the <i>Repository</i>
99
+        component of the name. A repository name is made up of slash-separated
100
+        name components, optionally prefixed by a DNS hostname. The hostname
101
+        must follow comply with standard DNS rules, but may not contain
102
+        <code>_</code> characters. If a hostname is present, it may optionally
103
+        be followed by a port number in the format <code>:8080</code>.
104
+        Name components may contain lowercase characters, digits, and
105
+        separators. A separator is defined as a period, one or two underscores,
106
+        or one or more dashes. A name component may not start or end with
107
+        a separator.
108
+    </dd>
109
+</dl>
110
+
111
+## Image JSON Description
112
+
113
+Here is an example image JSON file:
114
+
115
+```
116
+{  
117
+    "created": "2015-10-31T22:22:56.015925234Z",
118
+    "author": "Alyssa P. Hacker &ltalyspdev@example.com&gt",
119
+    "architecture": "amd64",
120
+    "os": "linux",
121
+    "config": {
122
+        "User": "alice",
123
+        "Memory": 2048,
124
+        "MemorySwap": 4096,
125
+        "CpuShares": 8,
126
+        "ExposedPorts": {  
127
+            "8080/tcp": {}
128
+        },
129
+        "Env": [  
130
+            "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin",
131
+            "FOO=docker_is_a_really",
132
+            "BAR=great_tool_you_know"
133
+        ],
134
+        "Entrypoint": [
135
+            "/bin/my-app-binary"
136
+        ],
137
+        "Cmd": [
138
+            "--foreground",
139
+            "--config",
140
+            "/etc/my-app.d/default.cfg"
141
+        ],
142
+        "Volumes": {
143
+            "/var/job-result-data": {},
144
+            "/var/log/my-app-logs": {},
145
+        },
146
+        "WorkingDir": "/home/alice",
147
+    },
148
+    "rootfs": {
149
+      "diff_ids": [
150
+        "sha256:c6f988f4874bb0add23a778f753c65efe992244e148a1d2ec2a8b664fb66bbd1",
151
+        "sha256:5f70bf18a086007016e948b04aed3b82103a36bea41755b6cddfaf10ace3c6ef"
152
+      ],
153
+      "type": "layers"
154
+    },
155
+    "history": [
156
+      {
157
+        "created": "2015-10-31T22:22:54.690851953Z",
158
+        "created_by": "/bin/sh -c #(nop) ADD file:a3bc1e842b69636f9df5256c49c5374fb4eef1e281fe3f282c65fb853ee171c5 in /"
159
+      },
160
+      {
161
+        "created": "2015-10-31T22:22:55.613815829Z",
162
+        "created_by": "/bin/sh -c #(nop) CMD [\"sh\"]",
163
+        "empty_layer": true
164
+      }
165
+    ]
166
+}
167
+```
168
+
169
+Note that image JSON files produced by Docker don't contain formatting
170
+whitespace. It has been added to this example for clarity.
171
+
172
+### Image JSON Field Descriptions
173
+
174
+<dl>
175
+    <dt>
176
+        created <code>string</code>
177
+    </dt>
178
+    <dd>
179
+        ISO-8601 formatted combined date and time at which the image was
180
+        created.
181
+    </dd>
182
+    <dt>
183
+        author <code>string</code>
184
+    </dt>
185
+    <dd>
186
+        Gives the name and/or email address of the person or entity which
187
+        created and is responsible for maintaining the image.
188
+    </dd>
189
+    <dt>
190
+        architecture <code>string</code>
191
+    </dt>
192
+    <dd>
193
+        The CPU architecture which the binaries in this image are built to run
194
+        on. Possible values include:
195
+        <ul>
196
+            <li>386</li>
197
+            <li>amd64</li>
198
+            <li>arm</li>
199
+        </ul>
200
+        More values may be supported in the future and any of these may or may
201
+        not be supported by a given container runtime implementation.
202
+    </dd>
203
+    <dt>
204
+        os <code>string</code>
205
+    </dt>
206
+    <dd>
207
+        The name of the operating system which the image is built to run on.
208
+        Possible values include:
209
+        <ul>
210
+            <li>darwin</li>
211
+            <li>freebsd</li>
212
+            <li>linux</li>
213
+        </ul>
214
+        More values may be supported in the future and any of these may or may
215
+        not be supported by a given container runtime implementation.
216
+    </dd>
217
+    <dt>
218
+        config <code>struct</code>
219
+    </dt>
220
+    <dd>
221
+        The execution parameters which should be used as a base when running a
222
+        container using the image. This field can be <code>null</code>, in
223
+        which case any execution parameters should be specified at creation of
224
+        the container.
225
+
226
+        <h4>Container RunConfig Field Descriptions</h4>
227
+
228
+        <dl>
229
+            <dt>
230
+                User <code>string</code>
231
+            </dt>
232
+            <dd>
233
+                <p>The username or UID which the process in the container should
234
+                run as. This acts as a default value to use when the value is
235
+                not specified when creating a container.</p>
236
+
237
+                <p>All of the following are valid:</p>
238
+
239
+                <ul>
240
+                    <li><code>user</code></li>
241
+                    <li><code>uid</code></li>
242
+                    <li><code>user:group</code></li>
243
+                    <li><code>uid:gid</code></li>
244
+                    <li><code>uid:group</code></li>
245
+                    <li><code>user:gid</code></li>
246
+                </ul>
247
+
248
+                <p>If <code>group</code>/<code>gid</code> is not specified, the
249
+                default group and supplementary groups of the given
250
+                <code>user</code>/<code>uid</code> in <code>/etc/passwd</code>
251
+                from the container are applied.</p>
252
+            </dd>
253
+            <dt>
254
+                Memory <code>integer</code>
255
+            </dt>
256
+            <dd>
257
+                Memory limit (in bytes). This acts as a default value to use
258
+                when the value is not specified when creating a container.
259
+            </dd>
260
+            <dt>
261
+                MemorySwap <code>integer</code>
262
+            </dt>
263
+            <dd>
264
+                Total memory usage (memory + swap); set to <code>-1</code> to
265
+                disable swap. This acts as a default value to use when the
266
+                value is not specified when creating a container.
267
+            </dd>
268
+            <dt>
269
+                CpuShares <code>integer</code>
270
+            </dt>
271
+            <dd>
272
+                CPU shares (relative weight vs. other containers). This acts as
273
+                a default value to use when the value is not specified when
274
+                creating a container.
275
+            </dd>
276
+            <dt>
277
+                ExposedPorts <code>struct</code>
278
+            </dt>
279
+            <dd>
280
+                A set of ports to expose from a container running this image.
281
+                This JSON structure value is unusual because it is a direct
282
+                JSON serialization of the Go type
283
+                <code>map[string]struct{}</code> and is represented in JSON as
284
+                an object mapping its keys to an empty object. Here is an
285
+                example:
286
+
287
+<pre>{
288
+    "8080": {},
289
+    "53/udp": {},
290
+    "2356/tcp": {}
291
+}</pre>
292
+
293
+                Its keys can be in the format of:
294
+                <ul>
295
+                    <li>
296
+                        <code>"port/tcp"</code>
297
+                    </li>
298
+                    <li>
299
+                        <code>"port/udp"</code>
300
+                    </li>
301
+                    <li>
302
+                        <code>"port"</code>
303
+                    </li>
304
+                </ul>
305
+                with the default protocol being <code>"tcp"</code> if not
306
+                specified.
307
+
308
+                These values act as defaults and are merged with any specified
309
+                when creating a container.
310
+            </dd>
311
+            <dt>
312
+                Env <code>array of strings</code>
313
+            </dt>
314
+            <dd>
315
+                Entries are in the format of <code>VARNAME="var value"</code>.
316
+                These values act as defaults and are merged with any specified
317
+                when creating a container.
318
+            </dd>
319
+            <dt>
320
+                Entrypoint <code>array of strings</code>
321
+            </dt>
322
+            <dd>
323
+                A list of arguments to use as the command to execute when the
324
+                container starts. This value acts as a  default and is replaced
325
+                by an entrypoint specified when creating a container.
326
+            </dd>
327
+            <dt>
328
+                Cmd <code>array of strings</code>
329
+            </dt>
330
+            <dd>
331
+                Default arguments to the entry point of the container. These
332
+                values act as defaults and are replaced with any specified when
333
+                creating a container. If an <code>Entrypoint</code> value is
334
+                not specified, then the first entry of the <code>Cmd</code>
335
+                array should be interpreted as the executable to run.
336
+            </dd>
337
+            <dt>
338
+                Healthcheck <code>struct</code>
339
+            </dt>
340
+            <dd>
341
+                A test to perform to determine whether the container is healthy.
342
+                Here is an example:
343
+<pre>{
344
+  "Test": [
345
+      "CMD-SHELL",
346
+      "/usr/bin/check-health localhost"
347
+  ],
348
+  "Interval": 30000000000,
349
+  "Timeout": 10000000000,
350
+  "Retries": 3
351
+}</pre>
352
+                The object has the following fields.
353
+                <dl>
354
+                    <dt>
355
+                        Test <code>array of strings</code>
356
+                    </dt>
357
+                    <dd>
358
+                        The test to perform to check that the container is healthy.
359
+                        The options are:
360
+                        <ul>
361
+                            <li><code>[]</code> : inherit healthcheck from base image</li>
362
+                            <li><code>["NONE"]</code> : disable healthcheck</li>
363
+                            <li><code>["CMD", arg1, arg2, ...]</code> : exec arguments directly</li>
364
+                            <li><code>["CMD-SHELL", command]</code> : run command with system's default shell</li>
365
+                        </ul>
366
+
367
+                        The test command should exit with a status of 0 if the container is healthy,
368
+                        or with 1 if it is unhealthy.
369
+                    </dd>
370
+                    <dt>
371
+                        Interval <code>integer</code>
372
+                    </dt>
373
+                    <dd>
374
+                        Number of nanoseconds to wait between probe attempts.
375
+                    </dd>
376
+                    <dt>
377
+                        Timeout <code>integer</code>
378
+                    </dt>
379
+                    <dd>
380
+                        Number of nanoseconds to wait before considering the check to have hung.
381
+                    </dd>
382
+                    <dt>
383
+                        Retries <code>integer</code>
384
+                    <dt>
385
+                    <dd>
386
+                        The number of consecutive failures needed to consider a container as unhealthy.
387
+                    </dd>
388
+                </dl>
389
+
390
+                In each case, the field can be omitted to indicate that the
391
+                value should be inherited from the base layer.
392
+
393
+                These values act as defaults and are merged with any specified
394
+                when creating a container.
395
+            </dd>
396
+            <dt>
397
+                Volumes <code>struct</code>
398
+            </dt>
399
+            <dd>
400
+                A set of directories which should be created as data volumes in
401
+                a container running this image. This JSON structure value is
402
+                unusual because it is a direct JSON serialization of the Go
403
+                type <code>map[string]struct{}</code> and is represented in
404
+                JSON as an object mapping its keys to an empty object. Here is
405
+                an example:
406
+<pre>{
407
+    "/var/my-app-data/": {},
408
+    "/etc/some-config.d/": {},
409
+}</pre>
410
+            </dd>
411
+            <dt>
412
+                WorkingDir <code>string</code>
413
+            </dt>
414
+            <dd>
415
+                Sets the current working directory of the entry point process
416
+                in the container. This value acts as a default and is replaced
417
+                by a working directory specified when creating a container.
418
+            </dd>
419
+        </dl>
420
+    </dd>
421
+    <dt>
422
+        rootfs <code>struct</code>
423
+    </dt>
424
+    <dd>
425
+        The rootfs key references the layer content addresses used by the
426
+        image. This makes the image config hash depend on the filesystem hash.
427
+        rootfs has two subkeys:
428
+
429
+        <ul>
430
+          <li>
431
+            <code>type</code> is usually set to <code>layers</code>.
432
+          </li>
433
+          <li>
434
+            <code>diff_ids</code> is an array of layer content hashes (<code>DiffIDs</code>), in order from bottom-most to top-most.
435
+          </li>
436
+        </ul>
437
+
438
+
439
+        Here is an example rootfs section:
440
+
441
+<pre>"rootfs": {
442
+  "diff_ids": [
443
+    "sha256:c6f988f4874bb0add23a778f753c65efe992244e148a1d2ec2a8b664fb66bbd1",
444
+    "sha256:5f70bf18a086007016e948b04aed3b82103a36bea41755b6cddfaf10ace3c6ef",
445
+    "sha256:13f53e08df5a220ab6d13c58b2bf83a59cbdc2e04d0a3f041ddf4b0ba4112d49"
446
+  ],
447
+  "type": "layers"
448
+}</pre>
449
+    </dd>
450
+    <dt>
451
+        history <code>struct</code>
452
+    </dt>
453
+    <dd>
454
+        <code>history</code> is an array of objects describing the history of
455
+        each layer. The array is ordered from bottom-most layer to top-most
456
+        layer. The object has the following fields.
457
+
458
+        <ul>
459
+          <li>
460
+            <code>created</code>: Creation time, expressed as a ISO-8601 formatted
461
+            combined date and time
462
+          </li>
463
+          <li>
464
+            <code>author</code>: The author of the build point
465
+          </li>
466
+          <li>
467
+            <code>created_by</code>: The command which created the layer
468
+          </li>
469
+          <li>
470
+            <code>comment</code>: A custom message set when creating the layer
471
+          </li>
472
+          <li>
473
+            <code>empty_layer</code>: This field is used to mark if the history
474
+            item created a filesystem diff. It is set to true if this history
475
+            item doesn't correspond to an actual layer in the rootfs section
476
+            (for example, a command like ENV which results in no change to the
477
+            filesystem).
478
+          </li>
479
+        </ul>
480
+
481
+Here is an example history section:
482
+
483
+<pre>"history": [
484
+  {
485
+    "created": "2015-10-31T22:22:54.690851953Z",
486
+    "created_by": "/bin/sh -c #(nop) ADD file:a3bc1e842b69636f9df5256c49c5374fb4eef1e281fe3f282c65fb853ee171c5 in /"
487
+  },
488
+  {
489
+    "created": "2015-10-31T22:22:55.613815829Z",
490
+    "created_by": "/bin/sh -c #(nop) CMD [\"sh\"]",
491
+    "empty_layer": true
492
+  }
493
+]</pre>
494
+    </dd>
495
+</dl>
496
+
497
+Any extra fields in the Image JSON struct are considered implementation
498
+specific and should be ignored by any implementations which are unable to
499
+interpret them.
500
+
501
+## Creating an Image Filesystem Changeset
502
+
503
+An example of creating an Image Filesystem Changeset follows.
504
+
505
+An image root filesystem is first created as an empty directory. Here is the
506
+initial empty directory structure for the a changeset using the
507
+randomly-generated directory name `c3167915dc9d` ([actual layer DiffIDs are
508
+generated based on the content](#id_desc)).
509
+
510
+```
511
+c3167915dc9d/
512
+```
513
+
514
+Files and directories are then created:
515
+
516
+```
517
+c3167915dc9d/
518
+    etc/
519
+        my-app-config
520
+    bin/
521
+        my-app-binary
522
+        my-app-tools
523
+```
524
+
525
+The `c3167915dc9d` directory is then committed as a plain Tar archive with
526
+entries for the following files:
527
+
528
+```
529
+etc/my-app-config
530
+bin/my-app-binary
531
+bin/my-app-tools
532
+```
533
+
534
+To make changes to the filesystem of this container image, create a new
535
+directory, such as `f60c56784b83`, and initialize it with a snapshot of the
536
+parent image's root filesystem, so that the directory is identical to that
537
+of `c3167915dc9d`. NOTE: a copy-on-write or union filesystem can make this very
538
+efficient:
539
+
540
+```
541
+f60c56784b83/
542
+    etc/
543
+        my-app-config
544
+    bin/
545
+        my-app-binary
546
+        my-app-tools
547
+```
548
+
549
+This example change is going add a configuration directory at `/etc/my-app.d`
550
+which contains a default config file. There's also a change to the
551
+`my-app-tools` binary to handle the config layout change. The `f60c56784b83`
552
+directory then looks like this:
553
+
554
+```
555
+f60c56784b83/
556
+    etc/
557
+        my-app.d/
558
+            default.cfg
559
+    bin/
560
+        my-app-binary
561
+        my-app-tools
562
+```
563
+
564
+This reflects the removal of `/etc/my-app-config` and creation of a file and
565
+directory at `/etc/my-app.d/default.cfg`. `/bin/my-app-tools` has also been
566
+replaced with an updated version. Before committing this directory to a
567
+changeset, because it has a parent image, it is first compared with the
568
+directory tree of the parent snapshot, `f60c56784b83`, looking for files and
569
+directories that have been added, modified, or removed. The following changeset
570
+is found:
571
+
572
+```
573
+Added:      /etc/my-app.d/default.cfg
574
+Modified:   /bin/my-app-tools
575
+Deleted:    /etc/my-app-config
576
+```
577
+
578
+A Tar Archive is then created which contains *only* this changeset: The added
579
+and modified files and directories in their entirety, and for each deleted item
580
+an entry for an empty file at the same location but with the basename of the
581
+deleted file or directory prefixed with `.wh.`. The filenames prefixed with
582
+`.wh.` are known as "whiteout" files. NOTE: For this reason, it is not possible
583
+to create an image root filesystem which contains a file or directory with a
584
+name beginning with `.wh.`. The resulting Tar archive for `f60c56784b83` has
585
+the following entries:
586
+
587
+```
588
+/etc/my-app.d/default.cfg
589
+/bin/my-app-tools
590
+/etc/.wh.my-app-config
591
+```
592
+
593
+Any given image is likely to be composed of several of these Image Filesystem
594
+Changeset tar archives.
595
+
596
+## Combined Image JSON + Filesystem Changeset Format
597
+
598
+There is also a format for a single archive which contains complete information
599
+about an image, including:
600
+
601
+ - repository names/tags
602
+ - image configuration JSON file
603
+ - all tar archives of each layer filesystem changesets
604
+
605
+For example, here's what the full archive of `library/busybox` is (displayed in
606
+`tree` format):
607
+
608
+```
609
+.
610
+├── 47bcc53f74dc94b1920f0b34f6036096526296767650f223433fe65c35f149eb.json
611
+├── 5f29f704785248ddb9d06b90a11b5ea36c534865e9035e4022bb2e71d4ecbb9a
612
+│   ├── VERSION
613
+│   ├── json
614
+│   └── layer.tar
615
+├── a65da33792c5187473faa80fa3e1b975acba06712852d1dea860692ccddf3198
616
+│   ├── VERSION
617
+│   ├── json
618
+│   └── layer.tar
619
+├── manifest.json
620
+└── repositories
621
+```
622
+
623
+There is a directory for each layer in the image. Each directory is named with
624
+a 64 character hex name that is deterministically generated from the layer
625
+information. These names are not necessarily layer DiffIDs or ChainIDs. Each of
626
+these directories contains 3 files:
627
+
628
+ * `VERSION` - The schema version of the `json` file
629
+ * `json` - The legacy JSON metadata for an image layer. In this version of
630
+    the image specification, layers don't have JSON metadata, but in
631
+    [version 1](v1.md), they did. A file is created for each layer in the
632
+    v1 format for backward compatibility.
633
+ * `layer.tar` - The Tar archive of the filesystem changeset for an image
634
+   layer.
635
+
636
+Note that this directory layout is only important for backward compatibility.
637
+Current implementations use the paths specified in `manifest.json`.
638
+
639
+The content of the `VERSION` files is simply the semantic version of the JSON
640
+metadata schema:
641
+
642
+```
643
+1.0
644
+```
645
+
646
+The `repositories` file is another JSON file which describes names/tags:
647
+
648
+```
649
+{  
650
+    "busybox":{  
651
+        "latest":"5f29f704785248ddb9d06b90a11b5ea36c534865e9035e4022bb2e71d4ecbb9a"
652
+    }
653
+}
654
+```
655
+
656
+Every key in this object is the name of a repository, and maps to a collection
657
+of tag suffixes. Each tag maps to the ID of the image represented by that tag.
658
+This file is only used for backwards compatibility. Current implementations use
659
+the `manifest.json` file instead.
660
+
661
+The `manifest.json` file provides the image JSON for the top-level image, and
662
+optionally for parent images that this image was derived from. It consists of
663
+an array of metadata entries:
664
+
665
+```
666
+[
667
+  {
668
+    "Config": "47bcc53f74dc94b1920f0b34f6036096526296767650f223433fe65c35f149eb.json",
669
+    "RepoTags": ["busybox:latest"],
670
+    "Layers": [
671
+      "a65da33792c5187473faa80fa3e1b975acba06712852d1dea860692ccddf3198/layer.tar",
672
+      "5f29f704785248ddb9d06b90a11b5ea36c534865e9035e4022bb2e71d4ecbb9a/layer.tar"
673
+    ]
674
+  }
675
+]
676
+```
677
+
678
+There is an entry in the array for each image.
679
+
680
+The `Config` field references another file in the tar which includes the image
681
+JSON for this image.
682
+
683
+The `RepoTags` field lists references pointing to this image.
684
+
685
+The `Layers` field points to the filesystem changeset tars.
686
+
687
+An optional `Parent` field references the imageID of the parent image. This
688
+parent must be part of the same `manifest.json` file.
689
+
690
+This file shouldn't be confused with the distribution manifest, used to push
691
+and pull images.
692
+
693
+Generally, implementations that support this version of the spec will use
694
+the `manifest.json` file if available, and older implementations will use the
695
+legacy `*/json` files and `repositories`.