Container Structure Test
The Container Structure Tests provide a powerful framework to validate the structure of a container image
container-structure-test.yamlstructure-test.yaml
Validate
Check your file against this schema
Opens the validator with this schema already loaded. Paste your
container-structure-test.yaml and it validates in your browser — nothing is uploaded.
Reference
Fields
Generated directly from the schema, following local
$refs, to two levels of nesting.
| Field | Type | Description |
|---|---|---|
schemaVersionrequired | string | The schema version of Structure Tests. default: "2.0.0" |
commandTests | array<object> | A list of command tests |
fileExistenceTests | array<object> | File existence tests check to make sure a specific file (or directory) exist within the file system of the image. No contents of the files or directories are checked. These tests can also be used to ensure a file or directory is not |
fileContentTests | array<object> | File content tests open a file on the file system and check its contents. These tests assume the specified file is a file, and that it exists |
licenseTests | array<object> | License tests check a list of copyright files and makes sure all licenses are allowed at Google. By default it will look at where Debian lists all copyright files, but can also look at an arbitrary list of files. |
metadataTest | object | — |
metadataTest.env | array | A list of environment variable key/value pairs that should be set in the container. |
metadataTest.labels | array | A list of image labels key/value pairs that should be set on the container. |
metadataTest.entrypoint | array<string> | The entrypoint of the container |
metadataTest.cmd | array<string> | The CMD specified in the container |
metadataTest.exposedPorts | array<string> | The ports exposed in the container. |
metadataTest.unexposedPorts | array<string> | The ports NOT exposed in the container. |
metadataTest.volumes | array<string> | The volumes exposed in the container. |
metadataTest.unmountedVolumes | array<string> | The volumes NOT exposed in the container |
metadataTest.workdir | string | The default working directory of the container. |
globalEnvVars | array | A list of environment variables can optionally be specified as part of the test setup. |
Audit
What we found in this schema
- Declared draft: draft-07
- Validates cleanly against its own meta-schema.
- 45 properties, 96% carrying a description, max nesting depth 8.
Standards
Specification sections for the keywords in this schema
| Keyword | Document | Section |
|---|---|---|
$comment | JSON Schema Core, draft 2020-12 | §8.3 — Comments With "$comment" |
$id | JSON Schema Core, draft 2020-12 | §8.2.1 — The "$id" Keyword |
$ref | JSON Schema Core, draft 2020-12 | §8.2.3.1 — Direct References with "$ref" |
$schema | JSON Schema Core, draft 2020-12 | §8.1.1 — "$schema" |
additionalProperties | JSON Schema Core, draft 2020-12 | §10.3.2.3 — "additionalProperties" |
default | JSON Schema Validation, draft 2020-12 | §9.2 — "default" |
description | JSON Schema Validation, draft 2020-12 | §9.1 — "title" and "description" |
items | JSON Schema Core, draft 2020-12 | §10.3.1.2 — "items" |
minItems | JSON Schema Validation, draft 2020-12 | §6.4.2 — "minItems" |
properties | JSON Schema Core, draft 2020-12 | §10.3.2.1 — "properties" |
required | JSON Schema Validation, draft 2020-12 | §6.5.3 — "required" |
type | JSON Schema Validation, draft 2020-12 | §6.1.1 — "type" |
Documents
- JSON Schema Core, draft 2020-12 — JSON Schema: A Media Type for Describing JSON Documents, A. Wright, H. Andrews, B. Hutton, G. Dennis, Eds., 2022. draft-bhutton-json-schema-01. An expired Internet-Draft with no formal standing in the IETF standards process; it is nonetheless the specification of record for JSON Schema 2020-12, published by json-schema.org.
- JSON Schema Validation, draft 2020-12 — JSON Schema Validation: A Vocabulary for Structural Validation of JSON, A. Wright, H. Andrews, B. Hutton, Eds., 2022.
- RFC 8259 (STD 90) — The JavaScript Object Notation (JSON) Data Interchange Format, T. Bray, Ed., 2017. The format a schema describes.
- RFC 6901 — JavaScript Object Notation (JSON) Pointer. Defines the pointer syntax used by $ref fragments and the ~0 / ~1 escapes.
Source
Attribution
This schema comes from SchemaStore, distributed under the Apache License 2.0. Copyright 2015–present Mads Kristensen and contributors. View the original file. The field table and audit on this page are generated by JSONTools.tools; the schema itself is unmodified.