config.go 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  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. package v1
  15. import (
  16. "time"
  17. digest "github.com/opencontainers/go-digest"
  18. )
  19. // ImageConfig defines the execution parameters which should be used as a base when running a container using an image.
  20. type ImageConfig struct {
  21. // User defines the username or UID which the process in the container should run as.
  22. User string `json:"User,omitempty"`
  23. // ExposedPorts a set of ports to expose from a container running this image.
  24. ExposedPorts map[string]struct{} `json:"ExposedPorts,omitempty"`
  25. // Env is a list of environment variables to be used in a container.
  26. Env []string `json:"Env,omitempty"`
  27. // Entrypoint defines a list of arguments to use as the command to execute when the container starts.
  28. Entrypoint []string `json:"Entrypoint,omitempty"`
  29. // Cmd defines the default arguments to the entrypoint of the container.
  30. Cmd []string `json:"Cmd,omitempty"`
  31. // Volumes is a set of directories describing where the process is likely write data specific to a container instance.
  32. Volumes map[string]struct{} `json:"Volumes,omitempty"`
  33. // WorkingDir sets the current working directory of the entrypoint process in the container.
  34. WorkingDir string `json:"WorkingDir,omitempty"`
  35. // Labels contains arbitrary metadata for the container.
  36. Labels map[string]string `json:"Labels,omitempty"`
  37. // StopSignal contains the system call signal that will be sent to the container to exit.
  38. StopSignal string `json:"StopSignal,omitempty"`
  39. // ArgsEscaped `[Deprecated]` - This field is present only for legacy
  40. // compatibility with Docker and should not be used by new image builders.
  41. // It is used by Docker for Windows images to indicate that the `Entrypoint`
  42. // or `Cmd` or both, contains only a single element array, that is a
  43. // pre-escaped, and combined into a single string `CommandLine`. If `true`
  44. // the value in `Entrypoint` or `Cmd` should be used as-is to avoid double
  45. // escaping.
  46. ArgsEscaped bool `json:"ArgsEscaped,omitempty"`
  47. }
  48. // RootFS describes a layer content addresses
  49. type RootFS struct {
  50. // Type is the type of the rootfs.
  51. Type string `json:"type"`
  52. // DiffIDs is an array of layer content hashes (DiffIDs), in order from bottom-most to top-most.
  53. DiffIDs []digest.Digest `json:"diff_ids"`
  54. }
  55. // History describes the history of a layer.
  56. type History struct {
  57. // Created is the combined date and time at which the layer was created, formatted as defined by RFC 3339, section 5.6.
  58. Created *time.Time `json:"created,omitempty"`
  59. // CreatedBy is the command which created the layer.
  60. CreatedBy string `json:"created_by,omitempty"`
  61. // Author is the author of the build point.
  62. Author string `json:"author,omitempty"`
  63. // Comment is a custom message set when creating the layer.
  64. Comment string `json:"comment,omitempty"`
  65. // EmptyLayer is used to mark if the history item created a filesystem diff.
  66. EmptyLayer bool `json:"empty_layer,omitempty"`
  67. }
  68. // Image is the JSON structure which describes some basic information about the image.
  69. // This provides the `application/vnd.oci.image.config.v1+json` mediatype when marshalled to JSON.
  70. type Image struct {
  71. // Created is the combined date and time at which the image was created, formatted as defined by RFC 3339, section 5.6.
  72. Created *time.Time `json:"created,omitempty"`
  73. // Author defines the name and/or email address of the person or entity which created and is responsible for maintaining the image.
  74. Author string `json:"author,omitempty"`
  75. // Architecture is the CPU architecture which the binaries in this image are built to run on.
  76. Architecture string `json:"architecture"`
  77. // Variant is the variant of the specified CPU architecture which image binaries are intended to run on.
  78. Variant string `json:"variant,omitempty"`
  79. // OS is the name of the operating system which the image is built to run on.
  80. OS string `json:"os"`
  81. // OSVersion is an optional field specifying the operating system
  82. // version, for example on Windows `10.0.14393.1066`.
  83. OSVersion string `json:"os.version,omitempty"`
  84. // OSFeatures is an optional field specifying an array of strings,
  85. // each listing a required OS feature (for example on Windows `win32k`).
  86. OSFeatures []string `json:"os.features,omitempty"`
  87. // Config defines the execution parameters which should be used as a base when running a container using the image.
  88. Config ImageConfig `json:"config,omitempty"`
  89. // RootFS references the layer content addresses used by the image.
  90. RootFS RootFS `json:"rootfs"`
  91. // History describes the history of each layer.
  92. History []History `json:"history,omitempty"`
  93. }