types.go 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266
  1. package types
  2. import (
  3. "time"
  4. "github.com/docker/docker/daemon/network"
  5. "github.com/docker/docker/pkg/version"
  6. "github.com/docker/docker/runconfig"
  7. )
  8. // ContainerCreateResponse contains the information returned to a client on the
  9. // creation of a new container.
  10. type ContainerCreateResponse struct {
  11. // ID is the ID of the created container.
  12. ID string `json:"Id"`
  13. // Warnings are any warnings encountered during the creation of the container.
  14. Warnings []string `json:"Warnings"`
  15. }
  16. // POST /containers/{name:.*}/exec
  17. type ContainerExecCreateResponse struct {
  18. // ID is the exec ID.
  19. ID string `json:"Id"`
  20. }
  21. // POST /auth
  22. type AuthResponse struct {
  23. // Status is the authentication status
  24. Status string `json:"Status"`
  25. }
  26. // POST "/containers/"+containerID+"/wait"
  27. type ContainerWaitResponse struct {
  28. // StatusCode is the status code of the wait job
  29. StatusCode int `json:"StatusCode"`
  30. }
  31. // POST "/commit?container="+containerID
  32. type ContainerCommitResponse struct {
  33. ID string `json:"Id"`
  34. }
  35. // GET "/containers/{name:.*}/changes"
  36. type ContainerChange struct {
  37. Kind int
  38. Path string
  39. }
  40. // GET "/images/{name:.*}/history"
  41. type ImageHistory struct {
  42. ID string `json:"Id"`
  43. Created int64
  44. CreatedBy string
  45. Tags []string
  46. Size int64
  47. Comment string
  48. }
  49. // DELETE "/images/{name:.*}"
  50. type ImageDelete struct {
  51. Untagged string `json:",omitempty"`
  52. Deleted string `json:",omitempty"`
  53. }
  54. // GET "/images/json"
  55. type Image struct {
  56. ID string `json:"Id"`
  57. ParentId string
  58. RepoTags []string
  59. RepoDigests []string
  60. Created int
  61. Size int
  62. VirtualSize int
  63. Labels map[string]string
  64. }
  65. type GraphDriverData struct {
  66. Name string
  67. Data map[string]string
  68. }
  69. // GET "/images/{name:.*}/json"
  70. type ImageInspect struct {
  71. Id string
  72. Parent string
  73. Comment string
  74. Created time.Time
  75. Container string
  76. ContainerConfig *runconfig.Config
  77. DockerVersion string
  78. Author string
  79. Config *runconfig.Config
  80. Architecture string
  81. Os string
  82. Size int64
  83. VirtualSize int64
  84. GraphDriver GraphDriverData
  85. }
  86. // GET "/containers/json"
  87. type Port struct {
  88. IP string `json:",omitempty"`
  89. PrivatePort int
  90. PublicPort int `json:",omitempty"`
  91. Type string
  92. }
  93. type Container struct {
  94. ID string `json:"Id"`
  95. Names []string
  96. Image string
  97. Command string
  98. Created int
  99. Ports []Port
  100. SizeRw int `json:",omitempty"`
  101. SizeRootFs int `json:",omitempty"`
  102. Labels map[string]string
  103. Status string
  104. HostConfig struct {
  105. NetworkMode string `json:",omitempty"`
  106. }
  107. }
  108. // POST "/containers/"+containerID+"/copy"
  109. type CopyConfig struct {
  110. Resource string
  111. }
  112. // GET "/containers/{name:.*}/top"
  113. type ContainerProcessList struct {
  114. Processes [][]string
  115. Titles []string
  116. }
  117. type Version struct {
  118. Version string
  119. ApiVersion version.Version
  120. GitCommit string
  121. GoVersion string
  122. Os string
  123. Arch string
  124. KernelVersion string `json:",omitempty"`
  125. Experimental bool `json:",omitempty"`
  126. BuildTime string `json:",omitempty"`
  127. }
  128. // GET "/info"
  129. type Info struct {
  130. ID string
  131. Containers int
  132. Images int
  133. Driver string
  134. DriverStatus [][2]string
  135. MemoryLimit bool
  136. SwapLimit bool
  137. CpuCfsPeriod bool
  138. CpuCfsQuota bool
  139. IPv4Forwarding bool
  140. BridgeNfIptables bool
  141. BridgeNfIp6tables bool
  142. Debug bool
  143. NFd int
  144. OomKillDisable bool
  145. NGoroutines int
  146. SystemTime string
  147. ExecutionDriver string
  148. LoggingDriver string
  149. NEventsListener int
  150. KernelVersion string
  151. OperatingSystem string
  152. IndexServerAddress string
  153. RegistryConfig interface{}
  154. InitSha1 string
  155. InitPath string
  156. NCPU int
  157. MemTotal int64
  158. DockerRootDir string
  159. HttpProxy string
  160. HttpsProxy string
  161. NoProxy string
  162. Name string
  163. Labels []string
  164. ExperimentalBuild bool
  165. }
  166. // This struct is a temp struct used by execStart
  167. // Config fields is part of ExecConfig in runconfig package
  168. type ExecStartCheck struct {
  169. // ExecStart will first check if it's detached
  170. Detach bool
  171. // Check if there's a tty
  172. Tty bool
  173. }
  174. type ContainerState struct {
  175. Running bool
  176. Paused bool
  177. Restarting bool
  178. OOMKilled bool
  179. Dead bool
  180. Pid int
  181. ExitCode int
  182. Error string
  183. StartedAt time.Time
  184. FinishedAt time.Time
  185. }
  186. // GET "/containers/{name:.*}/json"
  187. type ContainerJSONBase struct {
  188. Id string
  189. Created time.Time
  190. Path string
  191. Args []string
  192. State *ContainerState
  193. Image string
  194. NetworkSettings *network.Settings
  195. ResolvConfPath string
  196. HostnamePath string
  197. HostsPath string
  198. LogPath string
  199. Name string
  200. RestartCount int
  201. Driver string
  202. ExecDriver string
  203. MountLabel string
  204. ProcessLabel string
  205. AppArmorProfile string
  206. ExecIDs []string
  207. HostConfig *runconfig.HostConfig
  208. GraphDriver GraphDriverData
  209. }
  210. type ContainerJSON struct {
  211. *ContainerJSONBase
  212. Mounts []MountPoint
  213. Config *runconfig.Config
  214. }
  215. // backcompatibility struct along with ContainerConfig
  216. type ContainerJSONPre120 struct {
  217. *ContainerJSONBase
  218. Volumes map[string]string
  219. VolumesRW map[string]bool
  220. Config *ContainerConfig
  221. }
  222. type ContainerConfig struct {
  223. *runconfig.Config
  224. // backward compatibility, they now live in HostConfig
  225. Memory int64
  226. MemorySwap int64
  227. CpuShares int64
  228. Cpuset string
  229. }
  230. // MountPoint represents a mount point configuration inside the container.
  231. type MountPoint struct {
  232. Name string `json:",omitempty"`
  233. Source string
  234. Destination string
  235. Driver string `json:",omitempty"`
  236. Mode string // this is internally named `Relabel`
  237. RW bool
  238. }