1 // Copyright 2016 The Linux Foundation 2 // 3 // Licensed under the Apache License, Version 2.0 (the "License"); 4 // you may not use this file except in compliance with the License. 5 // You may obtain a copy of the License at 6 // 7 // http://www.apache.org/licenses/LICENSE-2.0 8 // 9 // Unless required by applicable law or agreed to in writing, software 10 // distributed under the License is distributed on an "AS IS" BASIS, 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 // See the License for the specific language governing permissions and 13 // limitations under the License. 14 15 package v1 16 17 import ( 18 "time" 19 20 digest "github.com/opencontainers/go-digest" 21 ) 22 23 // ImageConfig defines the execution parameters which should be used as a base when running a container using an image. 24 type ImageConfig struct { 25 // User defines the username or UID which the process in the container should run as. 26 User string `json:"User,omitempty"` 27 28 // ExposedPorts a set of ports to expose from a container running this image. 29 ExposedPorts map[string]struct{} `json:"ExposedPorts,omitempty"` 30 31 // Env is a list of environment variables to be used in a container. 32 Env []string `json:"Env,omitempty"` 33 34 // Entrypoint defines a list of arguments to use as the command to execute when the container starts. 35 Entrypoint []string `json:"Entrypoint,omitempty"` 36 37 // Cmd defines the default arguments to the entrypoint of the container. 38 Cmd []string `json:"Cmd,omitempty"` 39 40 // Volumes is a set of directories describing where the process is likely write data specific to a container instance. 41 Volumes map[string]struct{} `json:"Volumes,omitempty"` 42 43 // WorkingDir sets the current working directory of the entrypoint process in the container. 44 WorkingDir string `json:"WorkingDir,omitempty"` 45 46 // Labels contains arbitrary metadata for the container. 47 Labels map[string]string `json:"Labels,omitempty"` 48 49 // StopSignal contains the system call signal that will be sent to the container to exit. 50 StopSignal string `json:"StopSignal,omitempty"` 51 52 // ArgsEscaped 53 // 54 // Deprecated: This field is present only for legacy compatibility with 55 // Docker and should not be used by new image builders. It is used by Docker 56 // for Windows images to indicate that the `Entrypoint` or `Cmd` or both, 57 // contains only a single element array, that is a pre-escaped, and combined 58 // into a single string `CommandLine`. If `true` the value in `Entrypoint` or 59 // `Cmd` should be used as-is to avoid double escaping. 60 // https://github.com/opencontainers/image-spec/pull/892 61 ArgsEscaped bool `json:"ArgsEscaped,omitempty"` 62 } 63 64 // RootFS describes a layer content addresses 65 type RootFS struct { 66 // Type is the type of the rootfs. 67 Type string `json:"type"` 68 69 // DiffIDs is an array of layer content hashes (DiffIDs), in order from bottom-most to top-most. 70 DiffIDs []digest.Digest `json:"diff_ids"` 71 } 72 73 // History describes the history of a layer. 74 type History struct { 75 // Created is the combined date and time at which the layer was created, formatted as defined by RFC 3339, section 5.6. 76 Created *time.Time `json:"created,omitempty"` 77 78 // CreatedBy is the command which created the layer. 79 CreatedBy string `json:"created_by,omitempty"` 80 81 // Author is the author of the build point. 82 Author string `json:"author,omitempty"` 83 84 // Comment is a custom message set when creating the layer. 85 Comment string `json:"comment,omitempty"` 86 87 // EmptyLayer is used to mark if the history item created a filesystem diff. 88 EmptyLayer bool `json:"empty_layer,omitempty"` 89 } 90 91 // Image is the JSON structure which describes some basic information about the image. 92 // This provides the `application/vnd.oci.image.config.v1+json` mediatype when marshalled to JSON. 93 type Image struct { 94 // Created is the combined date and time at which the image was created, formatted as defined by RFC 3339, section 5.6. 95 Created *time.Time `json:"created,omitempty"` 96 97 // Author defines the name and/or email address of the person or entity which created and is responsible for maintaining the image. 98 Author string `json:"author,omitempty"` 99 100 // Platform describes the platform which the image in the manifest runs on. 101 Platform 102 103 // Config defines the execution parameters which should be used as a base when running a container using the image. 104 Config ImageConfig `json:"config,omitempty"` 105 106 // RootFS references the layer content addresses used by the image. 107 RootFS RootFS `json:"rootfs"` 108 109 // History describes the history of each layer. 110 History []History `json:"history,omitempty"` 111 } 112