Container Build Plan Specification
November 9, 2021 ยท View on GitHub
Specification for building a container image.
Although looking similar, the structure and semantics of similarly named properties are different from the Docker/OCI Image Configuration.
Example
{
"baseImage": "eclipse-temurin:11-jre@sha256:a3036d6a01859e3fe8cbad4887ccb2e4afd5f5ce8f085ca6bc0302fcbb8601f7",
"architectureHint": "amd64",
"osHint": "linux",
"format": "Docker",
"created": "2011-12-03T22:42:05Z",
"config": {
"env": {
"KEY": "value",
"PATH": "/usr/sbin:/usr/bin:/sbin:/bin",
"HOME": "/home/guest"
},
"labels": {
"com.example.department.some-label-key": "avocado explosion",
"com.example.system.xml": "<message>delivered</message>"
},
"volumes": ["/mnt/shared", "/tmp"]
"exposedPorts": ["8080", "53/udp", "80/tcp"]
"user": ":12345",
"workingDir": "/
"entrypoint": ["/bin/bash", "-c"],
"cmd": [
"-x",
"set -o errexit ; echo \"\$0=\$0 \$1=\$1\" ; echo \"\$PATH=${PATH}\" ; exit 0",
"my-shell-name",
"first shell arg"
],
},
"layers": [
{
"type": "fileEntries"
"entries": [
{
"src": "/home/jane/workspace/bin/Main.class",
"dest": "/app/classes/Main.class",
"modificationTime": "2019-07-15T10:15:30+09:00",
"permissions": "600",
},
{
"src": "/home/jane/libs/util-1.0.jar",
"dest": "/app/jars/util.jar",
"modificationTime": "2011-12-03T22:42:05Z",
"permissions": "644",
}
]
},
{
"type": "layerArchive"
"mediaType": "...",
"path": "/home/jane/misc/cacerts.tar",
},
{
"type": "fileEntries"
"entries": [
{
"src": "/home/workspace/scripts/run.sh",
"dest": "/app/run.sh",
"modificationTime": "2011-12-03T22:42:05Z",
"permissions": "777",
"ownership": ""
},
]
},
...
]
}
Build Plan Object
-
baseImage: stringnullor omitted: no base image (from "scratch")
-
architectureHint: string- If the base image reference is an "image list" (Docker manifest list or an OCI image index), must be set so that an image builder can select the image matching the given architecture.
- If the base image reference is not an "image list", this value is ignored and the architecture of the built image follows that of the base image.
The default is "amd64" when omitted.
-
osHint: string- If the base image reference is an "image list" (Docker manifest list or an OCI image index), must be set so that an image builder can select the image matching the given OS.
- If the base image reference is not an "image list", this value is ignored and the OS of the built image follows that of the base image.
The default is "linux" when omitted.
-
format: stringImage output format. Either
"Docker"or"OCI".nullor omitted:"Docker"by default
-
created: stringISO 8601-like date-time format.
nullor omitted: the epoch ("1970-01-01T00:00:00Z") by default
-
config: Execution Parameters objectCan be
nullor omitted. -
layers: array of Layer Configuration objectsAdds layers on top of those from the base image; it is not possible to remove layers from the base image.
A builder implementation must inherit the history entries of base image layers.
Execution Parameters Object
-
env: map of (string, string)Adds environment variables on top of those from the base image (hence overridable for same variable names); it is not possible to unset variables from the base image.
-
labels: map of (string, string)Adds labels on top of those from the base image (hence overridable for same label keys); it is not possible to unset labels from the base image.
-
volumes: array of stringsAdds volumes on top of those from the base image (no duplicate entries possible); it is not possible to unset volumes from the base image.
-
exposedPorts: stringsAdds ports on top of those from the base image; it is not possible to unset ports from the base image.
-
user: stringnullor omitted: inherits from the base image.- Otherwise (including an empty string
"",":","<user>:", and":<group>"), sets the given user and group; it is not possible to only inherit either the user or the group.
-
workingDir: stringnullor omitted: inherits from the base image.- Otherwise (including an empty string
""), sets the given directory.
-
entrypoint: array of stringsnullor omitted: inherits from the base image.- Otherwise (including an empty list
[]and[""]), sets the given entrypoint. (Note, ifcmdis not given, also setscmdtonull.)
Note
[]is different from theDockerfilebuild behavior.Dockerfilebuild sets the entrypoint tonullif givenENTRYPOINT []. -
cmd: array of stringsentrypointcmdcmdset in containerdefined given value defined nullor omittednullnullor omittednullor omittedinherited Note
[]forentrypointandcmdis considered "defined".
Layer Configuration Object
-
type: stringfileEntries(collection of files as a layer),layerArchive(an archive file as a laye, to be implemented), etc.
fileEntries Sub-Type of Layer Configuration Object
entries: array of Layer Entry objects
Layer Entry Object
src: single local file, requireddest: path in the container, requiredpermissions: POSIX permissions, requiredmodificationTime: ifnullor omitted, the epoch + 1 second by defaultownership:- If
null, omitted, or an empty string"", then effectively equivalent to"0:0"("root:root"). - Otherwise, in the form of
"<user>:<group>"where<user>and<group>are optional. When<user>or<group>is omitted, it is equivalent to0(root).
- If