config.go 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  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
  40. //
  41. // Deprecated: This field is present only for legacy compatibility with
  42. // Docker and should not be used by new image builders. It is used by Docker
  43. // for Windows images to indicate that the `Entrypoint` or `Cmd` or both,
  44. // contains only a single element array, that is a pre-escaped, and combined
  45. // into a single string `CommandLine`. If `true` the value in `Entrypoint` or
  46. // `Cmd` should be used as-is to avoid double escaping.
  47. // https://github.com/opencontainers/image-spec/pull/892
  48. ArgsEscaped bool `json:"ArgsEscaped,omitempty"`
  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. // DiffIDs is an array of layer content hashes (DiffIDs), in order from bottom-most to top-most.
  55. DiffIDs []digest.Digest `json:"diff_ids"`
  56. }
  57. // History describes the history of a layer.
  58. type History struct {
  59. // Created is the combined date and time at which the layer was created, formatted as defined by RFC 3339, section 5.6.
  60. Created *time.Time `json:"created,omitempty"`
  61. // CreatedBy is the command which created the layer.
  62. CreatedBy string `json:"created_by,omitempty"`
  63. // Author is the author of the build point.
  64. Author string `json:"author,omitempty"`
  65. // Comment is a custom message set when creating the layer.
  66. Comment string `json:"comment,omitempty"`
  67. // EmptyLayer is used to mark if the history item created a filesystem diff.
  68. EmptyLayer bool `json:"empty_layer,omitempty"`
  69. }
  70. // Image is the JSON structure which describes some basic information about the image.
  71. // This provides the `application/vnd.oci.image.config.v1+json` mediatype when marshalled to JSON.
  72. type Image struct {
  73. // Created is the combined date and time at which the image was created, formatted as defined by RFC 3339, section 5.6.
  74. Created *time.Time `json:"created,omitempty"`
  75. // Author defines the name and/or email address of the person or entity which created and is responsible for maintaining the image.
  76. Author string `json:"author,omitempty"`
  77. // Platform describes the platform which the image in the manifest runs on.
  78. Platform
  79. // Config defines the execution parameters which should be used as a base when running a container using the image.
  80. Config ImageConfig `json:"config,omitempty"`
  81. // RootFS references the layer content addresses used by the image.
  82. RootFS RootFS `json:"rootfs"`
  83. // History describes the history of each layer.
  84. History []History `json:"history,omitempty"`
  85. }