|
| 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 | +// ImageConfig defines the execution parameters which should be used as a base when running a container using an image. |
| 18 | +type ImageConfig struct { |
| 19 | + // User defines the username or UID which the process in the container should run as. |
| 20 | + User string `json:"User"` |
| 21 | + |
| 22 | + // Memory defines the memory limit. |
| 23 | + Memory int64 `json:"Memory"` |
| 24 | + |
| 25 | + // MemorySwap defines the total memory usage limit (memory + swap). |
| 26 | + MemorySwap int64 `json:"MemorySwap"` |
| 27 | + |
| 28 | + // CPUShares is the CPU shares (relative weight vs. other containers). |
| 29 | + CPUShares int64 `json:"CpuShares"` |
| 30 | + |
| 31 | + // ExposedPorts a set of ports to expose from a container running this image. |
| 32 | + ExposedPorts map[string]struct{} `json:"ExposedPorts"` |
| 33 | + |
| 34 | + // Env is a list of environment variables to be used in a container. |
| 35 | + Env []string `json:"Env"` |
| 36 | + |
| 37 | + // Entrypoint defines a list of arguments to use as the command to execute when the container starts. |
| 38 | + EntryPoint []string `json:"EntryPoint"` |
| 39 | + |
| 40 | + // Cmd defines the default arguments to the entry point of the container. |
| 41 | + Cmd []string `json:"Cmd"` |
| 42 | + |
| 43 | + // Volumes is a set of directories which should be created as data volumes in a container running this image. |
| 44 | + Volumes map[string]struct{} `json:"Volumes"` |
| 45 | + |
| 46 | + // WorkingDir sets the current working directory of the entry point process in the container. |
| 47 | + WorkingDir string `json:"WorkingDir"` |
| 48 | +} |
| 49 | + |
| 50 | +// RootFS describes a layer content addresses |
| 51 | +type RootFS struct { |
| 52 | + // Type is the type of the rootfs. |
| 53 | + Type string `json:"type"` |
| 54 | + |
| 55 | + // DiffIDs is an array of layer content hashes (DiffIDs), in order from bottom-most to top-most. |
| 56 | + DiffIDs []string `json:"diff_ids"` |
| 57 | +} |
| 58 | + |
| 59 | +// History describes the history of a layer. |
| 60 | +type History struct { |
| 61 | + // Created is the creation time. |
| 62 | + Created string `json:"created"` |
| 63 | + |
| 64 | + // CreatedBy is the command which created the layer. |
| 65 | + CreatedBy string `json:"created_by"` |
| 66 | + |
| 67 | + // Author is the author of the build point. |
| 68 | + Author string `json:"author"` |
| 69 | + |
| 70 | + // Comment is a custom message set when creating the layer. |
| 71 | + Comment string `json:"comment"` |
| 72 | + |
| 73 | + // EmptyLayer is used to mark if the history item created a filesystem diff. |
| 74 | + EmptyLayer bool `json:"empty_layer"` |
| 75 | +} |
| 76 | + |
| 77 | +// Image is the JSON structure which describes some basic information about the image. |
| 78 | +type Image struct { |
| 79 | + // Created defines an ISO-8601 formatted combined date and time at which the image was created. |
| 80 | + Created string `json:"created"` |
| 81 | + |
| 82 | + // Author defines the name and/or email address of the person or entity which created and is responsible for maintaining the image. |
| 83 | + Author string `json:"author"` |
| 84 | + |
| 85 | + // Architecture is the CPU architecture which the binaries in this image are built to run on. |
| 86 | + Architecture string `json:"architecture"` |
| 87 | + |
| 88 | + // OS is the name of the operating system which the image is built to run on. |
| 89 | + OS string `json:"os"` |
| 90 | + |
| 91 | + // Config defines the execution parameters which should be used as a base when running a container using the image. |
| 92 | + Config ImageConfig `json:"config"` |
| 93 | + |
| 94 | + // RootFS references the layer content addresses used by the image. |
| 95 | + RootFS RootFS `json:"rootfs"` |
| 96 | + |
| 97 | + // History describes the history of each layer. |
| 98 | + History []History `json:"history"` |
| 99 | +} |
0 commit comments