daemon.go 47 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013
  1. package errors
  2. // This file contains all of the errors that can be generated from the
  3. // docker/daemon component.
  4. import (
  5. "net/http"
  6. "github.com/docker/distribution/registry/api/errcode"
  7. )
  8. var (
  9. // ErrorCodeNoSuchContainer is generated when we look for a container by
  10. // name or ID and we can't find it.
  11. ErrorCodeNoSuchContainer = errcode.Register(errGroup, errcode.ErrorDescriptor{
  12. Value: "NOSUCHCONTAINER",
  13. Message: "No such container: %s",
  14. Description: "The specified container can not be found",
  15. HTTPStatusCode: http.StatusNotFound,
  16. })
  17. // ErrorCodeUnregisteredContainer is generated when we try to load
  18. // a storage driver for an unregistered container
  19. ErrorCodeUnregisteredContainer = errcode.Register(errGroup, errcode.ErrorDescriptor{
  20. Value: "UNREGISTEREDCONTAINER",
  21. Message: "Can't load storage driver for unregistered container %s",
  22. Description: "An attempt was made to load the storage driver for a container that is not registered with the daemon",
  23. HTTPStatusCode: http.StatusInternalServerError,
  24. })
  25. // ErrorCodeContainerBeingRemoved is generated when an attempt to start
  26. // a container is made but its in the process of being removed, or is dead.
  27. ErrorCodeContainerBeingRemoved = errcode.Register(errGroup, errcode.ErrorDescriptor{
  28. Value: "CONTAINERBEINGREMOVED",
  29. Message: "Container is marked for removal and cannot be started.",
  30. Description: "An attempt was made to start a container that is in the process of being deleted",
  31. HTTPStatusCode: http.StatusInternalServerError,
  32. })
  33. // ErrorCodeUnpauseContainer is generated when we attempt to stop a
  34. // container but its paused.
  35. ErrorCodeUnpauseContainer = errcode.Register(errGroup, errcode.ErrorDescriptor{
  36. Value: "UNPAUSECONTAINER",
  37. Message: "Container %s is paused. Unpause the container before stopping",
  38. Description: "The specified container is paused, before it can be stopped it must be unpaused",
  39. HTTPStatusCode: http.StatusInternalServerError,
  40. })
  41. // ErrorCodeRemovalContainer is generated when we attempt to connect or disconnect a
  42. // container but it's marked for removal.
  43. ErrorCodeRemovalContainer = errcode.Register(errGroup, errcode.ErrorDescriptor{
  44. Value: "REMOVALCONTAINER",
  45. Message: "Container %s is marked for removal and cannot be connected or disconnected to the network",
  46. Description: "The specified container is marked for removal and cannot be connected or disconnected to the network",
  47. HTTPStatusCode: http.StatusInternalServerError,
  48. })
  49. // ErrorCodePausedContainer is generated when we attempt to attach a
  50. // container but its paused.
  51. ErrorCodePausedContainer = errcode.Register(errGroup, errcode.ErrorDescriptor{
  52. Value: "CONTAINERPAUSED",
  53. Message: "Container %s is paused. Unpause the container before attach",
  54. Description: "The specified container is paused, unpause the container before attach",
  55. HTTPStatusCode: http.StatusConflict,
  56. })
  57. // ErrorCodeAlreadyPaused is generated when we attempt to pause a
  58. // container when its already paused.
  59. ErrorCodeAlreadyPaused = errcode.Register(errGroup, errcode.ErrorDescriptor{
  60. Value: "ALREADYPAUSED",
  61. Message: "Container %s is already paused",
  62. Description: "The specified container is already in the paused state",
  63. HTTPStatusCode: http.StatusInternalServerError,
  64. })
  65. // ErrorCodeNotPaused is generated when we attempt to unpause a
  66. // container when its not paused.
  67. ErrorCodeNotPaused = errcode.Register(errGroup, errcode.ErrorDescriptor{
  68. Value: "NOTPAUSED",
  69. Message: "Container %s is not paused",
  70. Description: "The specified container can not be unpaused because it is not in a paused state",
  71. HTTPStatusCode: http.StatusInternalServerError,
  72. })
  73. // ErrorCodeImageUnregContainer is generated when we attempt to get the
  74. // image of an unknown/unregistered container.
  75. ErrorCodeImageUnregContainer = errcode.Register(errGroup, errcode.ErrorDescriptor{
  76. Value: "IMAGEUNREGCONTAINER",
  77. Message: "Can't get image of unregistered container",
  78. Description: "An attempt to retrieve the image of a container was made but the container is not registered",
  79. HTTPStatusCode: http.StatusInternalServerError,
  80. })
  81. // ErrorCodeEmptyID is generated when an ID is the empty string.
  82. ErrorCodeEmptyID = errcode.Register(errGroup, errcode.ErrorDescriptor{
  83. Value: "EMPTYID",
  84. Message: "Invalid empty id",
  85. Description: "An attempt was made to register a container but the container's ID can not be an empty string",
  86. HTTPStatusCode: http.StatusInternalServerError,
  87. })
  88. // ErrorCodeLoggingFactory is generated when we could not load the
  89. // log driver.
  90. ErrorCodeLoggingFactory = errcode.Register(errGroup, errcode.ErrorDescriptor{
  91. Value: "LOGGINGFACTORY",
  92. Message: "Failed to get logging factory: %v",
  93. Description: "An attempt was made to register a container but the container's ID can not be an empty string",
  94. HTTPStatusCode: http.StatusInternalServerError,
  95. })
  96. // ErrorCodeInitLogger is generated when we could not initialize
  97. // the logging driver.
  98. ErrorCodeInitLogger = errcode.Register(errGroup, errcode.ErrorDescriptor{
  99. Value: "INITLOGGER",
  100. Message: "Failed to initialize logging driver: %v",
  101. Description: "An error occurred while trying to initialize the logging driver",
  102. HTTPStatusCode: http.StatusInternalServerError,
  103. })
  104. // ErrorCodeNotRunning is generated when we need to verify that
  105. // a container is running, but its not.
  106. ErrorCodeNotRunning = errcode.Register(errGroup, errcode.ErrorDescriptor{
  107. Value: "NOTRUNNING",
  108. Message: "Container %s is not running",
  109. Description: "The specified action can not be taken due to the container not being in a running state",
  110. HTTPStatusCode: http.StatusInternalServerError,
  111. })
  112. // ErrorCodeLinkNotRunning is generated when we try to link to a
  113. // container that is not running.
  114. ErrorCodeLinkNotRunning = errcode.Register(errGroup, errcode.ErrorDescriptor{
  115. Value: "LINKNOTRUNNING",
  116. Message: "Cannot link to a non running container: %s AS %s",
  117. Description: "An attempt was made to link to a container but the container is not in a running state",
  118. HTTPStatusCode: http.StatusInternalServerError,
  119. })
  120. // ErrorCodeDeviceInfo is generated when there is an error while trying
  121. // to get info about a custom device.
  122. // container that is not running.
  123. ErrorCodeDeviceInfo = errcode.Register(errGroup, errcode.ErrorDescriptor{
  124. Value: "DEVICEINFO",
  125. Message: "error gathering device information while adding custom device %q: %s",
  126. Description: "There was an error while trying to retrieve the information about a custom device",
  127. HTTPStatusCode: http.StatusInternalServerError,
  128. })
  129. // ErrorCodeEmptyEndpoint is generated when the endpoint for a port
  130. // map is nil.
  131. ErrorCodeEmptyEndpoint = errcode.Register(errGroup, errcode.ErrorDescriptor{
  132. Value: "EMPTYENDPOINT",
  133. Message: "invalid endpoint while building port map info",
  134. Description: "The specified endpoint for the port mapping is empty",
  135. HTTPStatusCode: http.StatusInternalServerError,
  136. })
  137. // ErrorCodeEmptyNetwork is generated when the networkSettings for a port
  138. // map is nil.
  139. ErrorCodeEmptyNetwork = errcode.Register(errGroup, errcode.ErrorDescriptor{
  140. Value: "EMPTYNETWORK",
  141. Message: "invalid network settings while building port map info",
  142. Description: "The specified endpoint for the port mapping is empty",
  143. HTTPStatusCode: http.StatusInternalServerError,
  144. })
  145. // ErrorCodeParsingPort is generated when there is an error parsing
  146. // a "port" string.
  147. ErrorCodeParsingPort = errcode.Register(errGroup, errcode.ErrorDescriptor{
  148. Value: "PARSINGPORT",
  149. Message: "Error parsing Port value(%v):%v",
  150. Description: "There was an error while trying to parse the specified 'port' value",
  151. HTTPStatusCode: http.StatusInternalServerError,
  152. })
  153. // ErrorCodeNoSandbox is generated when we can't find the specified
  154. // sandbox(network) by ID.
  155. ErrorCodeNoSandbox = errcode.Register(errGroup, errcode.ErrorDescriptor{
  156. Value: "NOSANDBOX",
  157. Message: "error locating sandbox id %s: %v",
  158. Description: "There was an error trying to located the specified networking sandbox",
  159. HTTPStatusCode: http.StatusInternalServerError,
  160. })
  161. // ErrorCodeNetworkUpdate is generated when there is an error while
  162. // trying update a network/sandbox config.
  163. ErrorCodeNetworkUpdate = errcode.Register(errGroup, errcode.ErrorDescriptor{
  164. Value: "NETWORKUPDATE",
  165. Message: "Update network failed: %v",
  166. Description: "There was an error trying to update the configuration information of the specified network sandbox",
  167. HTTPStatusCode: http.StatusInternalServerError,
  168. })
  169. // ErrorCodeNetworkRefresh is generated when there is an error while
  170. // trying refresh a network/sandbox config.
  171. ErrorCodeNetworkRefresh = errcode.Register(errGroup, errcode.ErrorDescriptor{
  172. Value: "NETWORKREFRESH",
  173. Message: "Update network failed: Failure in refresh sandbox %s: %v",
  174. Description: "There was an error trying to refresh the configuration information of the specified network sandbox",
  175. HTTPStatusCode: http.StatusInternalServerError,
  176. })
  177. // ErrorCodeHostPort is generated when there was an error while trying
  178. // to parse a "host/port" string.
  179. ErrorCodeHostPort = errcode.Register(errGroup, errcode.ErrorDescriptor{
  180. Value: "HOSTPORT",
  181. Message: "Error parsing HostPort value(%s):%v",
  182. Description: "There was an error trying to parse the specified 'HostPort' value",
  183. HTTPStatusCode: http.StatusInternalServerError,
  184. })
  185. // ErrorCodeNetworkConflict is generated when we try to publish a service
  186. // in network mode.
  187. ErrorCodeNetworkConflict = errcode.Register(errGroup, errcode.ErrorDescriptor{
  188. Value: "NETWORKCONFLICT",
  189. Message: "conflicting options: publishing a service and network mode",
  190. Description: "It is not possible to publish a service when it is in network mode",
  191. HTTPStatusCode: http.StatusConflict,
  192. })
  193. // ErrorCodeJoinInfo is generated when we failed to update a container's
  194. // join info.
  195. ErrorCodeJoinInfo = errcode.Register(errGroup, errcode.ErrorDescriptor{
  196. Value: "JOININFO",
  197. Message: "Updating join info failed: %v",
  198. Description: "There was an error during an attempt update a container's join information",
  199. HTTPStatusCode: http.StatusInternalServerError,
  200. })
  201. // ErrorCodeIPCRunning is generated when we try to join a container's
  202. // IPC but it's not running.
  203. ErrorCodeIPCRunning = errcode.Register(errGroup, errcode.ErrorDescriptor{
  204. Value: "IPCRUNNING",
  205. Message: "cannot join IPC of a non running container: %s",
  206. Description: "An attempt was made to join the IPC of a container, but the container is not running",
  207. HTTPStatusCode: http.StatusConflict,
  208. })
  209. // ErrorCodeNotADir is generated when we try to create a directory
  210. // but the path isn't a dir.
  211. ErrorCodeNotADir = errcode.Register(errGroup, errcode.ErrorDescriptor{
  212. Value: "NOTADIR",
  213. Message: "Cannot mkdir: %s is not a directory",
  214. Description: "An attempt was made create a directory, but the location in which it is being created is not a directory",
  215. HTTPStatusCode: http.StatusInternalServerError,
  216. })
  217. // ErrorCodeParseContainer is generated when the reference to a
  218. // container doesn't include a ":" (another container).
  219. ErrorCodeParseContainer = errcode.Register(errGroup, errcode.ErrorDescriptor{
  220. Value: "PARSECONTAINER",
  221. Message: "no container specified to join network",
  222. Description: "The specified reference to a container is missing a ':' as a separator between 'container' and 'name'/'id'",
  223. HTTPStatusCode: http.StatusInternalServerError,
  224. })
  225. // ErrorCodeJoinSelf is generated when we try to network to ourselves.
  226. ErrorCodeJoinSelf = errcode.Register(errGroup, errcode.ErrorDescriptor{
  227. Value: "JOINSELF",
  228. Message: "cannot join own network",
  229. Description: "An attempt was made to have a container join its own network",
  230. HTTPStatusCode: http.StatusInternalServerError,
  231. })
  232. // ErrorCodeJoinRunning is generated when we try to network to ourselves.
  233. ErrorCodeJoinRunning = errcode.Register(errGroup, errcode.ErrorDescriptor{
  234. Value: "JOINRUNNING",
  235. Message: "cannot join network of a non running container: %s",
  236. Description: "An attempt to join the network of a container, but that container isn't running",
  237. HTTPStatusCode: http.StatusConflict,
  238. })
  239. // ErrorCodeModeNotContainer is generated when we try to network to
  240. // another container but the mode isn't 'container'.
  241. ErrorCodeModeNotContainer = errcode.Register(errGroup, errcode.ErrorDescriptor{
  242. Value: "MODENOTCONTAINER",
  243. Message: "network mode not set to container",
  244. Description: "An attempt was made to connect to a container's network but the mode wasn't set to 'container'",
  245. HTTPStatusCode: http.StatusInternalServerError,
  246. })
  247. // ErrorCodeRemovingVolume is generated when we try remove a mount
  248. // point (volume) but fail.
  249. ErrorCodeRemovingVolume = errcode.Register(errGroup, errcode.ErrorDescriptor{
  250. Value: "REMOVINGVOLUME",
  251. Message: "Error removing volumes:\n%v",
  252. Description: "There was an error while trying to remove the mount point (volume) of a container",
  253. HTTPStatusCode: http.StatusInternalServerError,
  254. })
  255. // ErrorCodeInvalidNetworkMode is generated when an invalid network
  256. // mode value is specified.
  257. ErrorCodeInvalidNetworkMode = errcode.Register(errGroup, errcode.ErrorDescriptor{
  258. Value: "INVALIDNETWORKMODE",
  259. Message: "invalid network mode: %s",
  260. Description: "The specified networking mode is not valid",
  261. HTTPStatusCode: http.StatusInternalServerError,
  262. })
  263. // ErrorCodeGetGraph is generated when there was an error while
  264. // trying to find a graph/image.
  265. ErrorCodeGetGraph = errcode.Register(errGroup, errcode.ErrorDescriptor{
  266. Value: "GETGRAPH",
  267. Message: "Failed to graph.Get on ImageID %s - %s",
  268. Description: "There was an error trying to retrieve the image for the specified image ID",
  269. HTTPStatusCode: http.StatusInternalServerError,
  270. })
  271. // ErrorCodeGetLayer is generated when there was an error while
  272. // trying to retrieve a particular layer of an image.
  273. ErrorCodeGetLayer = errcode.Register(errGroup, errcode.ErrorDescriptor{
  274. Value: "GETLAYER",
  275. Message: "Failed to get layer path from graphdriver %s for ImageID %s - %s",
  276. Description: "There was an error trying to retrieve the layer of the specified image",
  277. HTTPStatusCode: http.StatusInternalServerError,
  278. })
  279. // ErrorCodePutLayer is generated when there was an error while
  280. // trying to 'put' a particular layer of an image.
  281. ErrorCodePutLayer = errcode.Register(errGroup, errcode.ErrorDescriptor{
  282. Value: "PUTLAYER",
  283. Message: "Failed to put layer path from graphdriver %s for ImageID %s - %s",
  284. Description: "There was an error trying to store a layer for the specified image",
  285. HTTPStatusCode: http.StatusInternalServerError,
  286. })
  287. // ErrorCodeGetLayerMetadata is generated when there was an error while
  288. // trying to retrieve the metadata of a layer of an image.
  289. ErrorCodeGetLayerMetadata = errcode.Register(errGroup, errcode.ErrorDescriptor{
  290. Value: "GETLAYERMETADATA",
  291. Message: "Failed to get layer metadata - %s",
  292. Description: "There was an error trying to retrieve the metadata of a layer for the specified image",
  293. HTTPStatusCode: http.StatusInternalServerError,
  294. })
  295. // ErrorCodeEmptyConfig is generated when the input config data
  296. // is empty.
  297. ErrorCodeEmptyConfig = errcode.Register(errGroup, errcode.ErrorDescriptor{
  298. Value: "EMPTYCONFIG",
  299. Message: "Config cannot be empty in order to create a container",
  300. Description: "While trying to create a container, the specified configuration information was empty",
  301. HTTPStatusCode: http.StatusInternalServerError,
  302. })
  303. // ErrorCodeNoSuchImageHash is generated when we can't find the
  304. // specified image by its hash
  305. ErrorCodeNoSuchImageHash = errcode.Register(errGroup, errcode.ErrorDescriptor{
  306. Value: "NOSUCHIMAGEHASH",
  307. Message: "No such image: %s",
  308. Description: "An attempt was made to find an image by its hash, but the lookup failed",
  309. HTTPStatusCode: http.StatusNotFound,
  310. })
  311. // ErrorCodeNoSuchImageTag is generated when we can't find the
  312. // specified image byt its name/tag.
  313. ErrorCodeNoSuchImageTag = errcode.Register(errGroup, errcode.ErrorDescriptor{
  314. Value: "NOSUCHIMAGETAG",
  315. Message: "No such image: %s:%s",
  316. Description: "An attempt was made to find an image by its name/tag, but the lookup failed",
  317. HTTPStatusCode: http.StatusNotFound,
  318. })
  319. // ErrorCodeMountOverFile is generated when we try to mount a volume
  320. // over an existing file (but not a dir).
  321. ErrorCodeMountOverFile = errcode.Register(errGroup, errcode.ErrorDescriptor{
  322. Value: "MOUNTOVERFILE",
  323. Message: "cannot mount volume over existing file, file exists %s",
  324. Description: "An attempt was made to mount a volume at the same location as a pre-existing file",
  325. HTTPStatusCode: http.StatusInternalServerError,
  326. })
  327. // ErrorCodeMountSetup is generated when we can't define a mount point
  328. // due to the source and destination being undefined.
  329. ErrorCodeMountSetup = errcode.Register(errGroup, errcode.ErrorDescriptor{
  330. Value: "MOUNTSETUP",
  331. Message: "Unable to setup mount point, neither source nor volume defined",
  332. Description: "An attempt was made to setup a mount point, but the source and destination are undefined",
  333. HTTPStatusCode: http.StatusInternalServerError,
  334. })
  335. // ErrorCodeVolumeInvalidMode is generated when the mode of a volume/bind
  336. // mount is invalid.
  337. ErrorCodeVolumeInvalidMode = errcode.Register(errGroup, errcode.ErrorDescriptor{
  338. Value: "VOLUMEINVALIDMODE",
  339. Message: "invalid mode: %q",
  340. Description: "An invalid 'mode' was specified",
  341. HTTPStatusCode: http.StatusInternalServerError,
  342. })
  343. // ErrorCodeVolumeInvalid is generated when the format fo the
  344. // volume specification isn't valid.
  345. ErrorCodeVolumeInvalid = errcode.Register(errGroup, errcode.ErrorDescriptor{
  346. Value: "VOLUMEINVALID",
  347. Message: "Invalid volume specification: '%s'",
  348. Description: "An invalid 'volume' was specified in the mount request",
  349. HTTPStatusCode: http.StatusInternalServerError,
  350. })
  351. // ErrorCodeVolumeAbs is generated when path to a volume isn't absolute.
  352. ErrorCodeVolumeAbs = errcode.Register(errGroup, errcode.ErrorDescriptor{
  353. Value: "VOLUMEABS",
  354. Message: "Invalid volume destination path: '%s' mount path must be absolute.",
  355. Description: "An invalid 'destination' path was specified in the mount request, it must be an absolute path",
  356. HTTPStatusCode: http.StatusInternalServerError,
  357. })
  358. // ErrorCodeVolumeName is generated when the name of named volume isn't valid.
  359. ErrorCodeVolumeName = errcode.Register(errGroup, errcode.ErrorDescriptor{
  360. Value: "VOLUME_NAME_INVALID",
  361. Message: "%q includes invalid characters for a local volume name, only %q are allowed",
  362. Description: "The name of volume is invalid",
  363. HTTPStatusCode: http.StatusBadRequest,
  364. })
  365. // ErrorCodeVolumeSlash is generated when destination path to a volume is /
  366. ErrorCodeVolumeSlash = errcode.Register(errGroup, errcode.ErrorDescriptor{
  367. Value: "VOLUMESLASH",
  368. Message: "Invalid specification: destination can't be '/' in '%s'",
  369. HTTPStatusCode: http.StatusInternalServerError,
  370. })
  371. // ErrorCodeVolumeDestIsC is generated the destination is c: (Windows specific)
  372. ErrorCodeVolumeDestIsC = errcode.Register(errGroup, errcode.ErrorDescriptor{
  373. Value: "VOLUMEDESTISC",
  374. Message: "Destination drive letter in '%s' cannot be c:",
  375. HTTPStatusCode: http.StatusInternalServerError,
  376. })
  377. // ErrorCodeVolumeDestIsCRoot is generated the destination path is c:\ (Windows specific)
  378. ErrorCodeVolumeDestIsCRoot = errcode.Register(errGroup, errcode.ErrorDescriptor{
  379. Value: "VOLUMEDESTISCROOT",
  380. Message: `Destination path in '%s' cannot be c:\`,
  381. HTTPStatusCode: http.StatusInternalServerError,
  382. })
  383. // ErrorCodeVolumeSourceNotFound is generated the source directory could not be found (Windows specific)
  384. ErrorCodeVolumeSourceNotFound = errcode.Register(errGroup, errcode.ErrorDescriptor{
  385. Value: "VOLUMESOURCENOTFOUND",
  386. Message: "Source directory '%s' could not be found: %s",
  387. HTTPStatusCode: http.StatusInternalServerError,
  388. })
  389. // ErrorCodeVolumeSourceNotDirectory is generated the source is not a directory (Windows specific)
  390. ErrorCodeVolumeSourceNotDirectory = errcode.Register(errGroup, errcode.ErrorDescriptor{
  391. Value: "VOLUMESOURCENOTDIRECTORY",
  392. Message: "Source '%s' is not a directory",
  393. HTTPStatusCode: http.StatusInternalServerError,
  394. })
  395. // ErrorCodeVolumeFromBlank is generated when path to a volume is blank.
  396. ErrorCodeVolumeFromBlank = errcode.Register(errGroup, errcode.ErrorDescriptor{
  397. Value: "VOLUMEFROMBLANK",
  398. Message: "malformed volumes-from specification: %q",
  399. Description: "An invalid 'destination' path was specified in the mount request, it must not be blank",
  400. HTTPStatusCode: http.StatusInternalServerError,
  401. })
  402. // ErrorCodeMountDup is generated when we try to mount two mounts points
  403. // to the same path.
  404. ErrorCodeMountDup = errcode.Register(errGroup, errcode.ErrorDescriptor{
  405. Value: "MOUNTDUP",
  406. Message: "Duplicate mount point '%s'",
  407. Description: "An attempt was made to mount a content but the specified destination location is already used in a previous mount",
  408. HTTPStatusCode: http.StatusInternalServerError,
  409. })
  410. // ErrorCodeVolumeNoSourceForMount is generated when no source directory
  411. // for a volume mount was found. (Windows specific)
  412. ErrorCodeVolumeNoSourceForMount = errcode.Register(errGroup, errcode.ErrorDescriptor{
  413. Value: "VOLUMENOSOURCEFORMOUNT",
  414. Message: "No source for mount name '%s' driver %q destination '%s'",
  415. HTTPStatusCode: http.StatusInternalServerError,
  416. })
  417. // ErrorCodeVolumeNameReservedWord is generated when the name in a volume
  418. // uses a reserved word for filenames. (Windows specific)
  419. ErrorCodeVolumeNameReservedWord = errcode.Register(errGroup, errcode.ErrorDescriptor{
  420. Value: "VOLUMENAMERESERVEDWORD",
  421. Message: "Volume name %q cannot be a reserved word for Windows filenames",
  422. HTTPStatusCode: http.StatusInternalServerError,
  423. })
  424. // ErrorCodeCantPause is generated when there's an error while trying
  425. // to pause a container.
  426. ErrorCodeCantPause = errcode.Register(errGroup, errcode.ErrorDescriptor{
  427. Value: "CANTPAUSE",
  428. Message: "Cannot pause container %s: %s",
  429. Description: "An error occurred while trying to pause the specified container",
  430. HTTPStatusCode: http.StatusInternalServerError,
  431. })
  432. // ErrorCodeCantUnpause is generated when there's an error while trying
  433. // to unpause a container.
  434. ErrorCodeCantUnpause = errcode.Register(errGroup, errcode.ErrorDescriptor{
  435. Value: "CANTUNPAUSE",
  436. Message: "Cannot unpause container %s: %s",
  437. Description: "An error occurred while trying to unpause the specified container",
  438. HTTPStatusCode: http.StatusInternalServerError,
  439. })
  440. // ErrorCodeCantKill is generated when there's an error while trying
  441. // to kill a container.
  442. ErrorCodeCantKill = errcode.Register(errGroup, errcode.ErrorDescriptor{
  443. Value: "CANTKILL",
  444. Message: "Cannot kill container %s: %s",
  445. Description: "An error occurred while trying to kill the specified container",
  446. HTTPStatusCode: http.StatusInternalServerError,
  447. })
  448. // ErrorCodeCantUpdate is generated when there's an error while trying
  449. // to update a container.
  450. ErrorCodeCantUpdate = errcode.Register(errGroup, errcode.ErrorDescriptor{
  451. Value: "CANTUPDATE",
  452. Message: "Cannot update container %s: %s",
  453. Description: "An error occurred while trying to update the specified container",
  454. HTTPStatusCode: http.StatusInternalServerError,
  455. })
  456. // ErrorCodePSError is generated when trying to run 'ps'.
  457. ErrorCodePSError = errcode.Register(errGroup, errcode.ErrorDescriptor{
  458. Value: "PSError",
  459. Message: "Error running ps: %s",
  460. Description: "There was an error trying to run the 'ps' command in the specified container",
  461. HTTPStatusCode: http.StatusInternalServerError,
  462. })
  463. // ErrorCodeNoPID is generated when looking for the PID field in the
  464. // ps output.
  465. ErrorCodeNoPID = errcode.Register(errGroup, errcode.ErrorDescriptor{
  466. Value: "NOPID",
  467. Message: "Couldn't find PID field in ps output",
  468. Description: "There was no 'PID' field in the output of the 'ps' command that was executed",
  469. HTTPStatusCode: http.StatusInternalServerError,
  470. })
  471. // ErrorCodeBadPID is generated when we can't convert a PID to an int.
  472. ErrorCodeBadPID = errcode.Register(errGroup, errcode.ErrorDescriptor{
  473. Value: "BADPID",
  474. Message: "Unexpected pid '%s': %s",
  475. Description: "While trying to parse the output of the 'ps' command, the 'PID' field was not an integer",
  476. HTTPStatusCode: http.StatusInternalServerError,
  477. })
  478. // ErrorCodeNoTop is generated when we try to run 'top' but can't
  479. // because we're on windows.
  480. ErrorCodeNoTop = errcode.Register(errGroup, errcode.ErrorDescriptor{
  481. Value: "NOTOP",
  482. Message: "Top is not supported on Windows",
  483. Description: "The 'top' command is not supported on Windows",
  484. HTTPStatusCode: http.StatusInternalServerError,
  485. })
  486. // ErrorCodeStopped is generated when we try to stop a container
  487. // that is already stopped.
  488. ErrorCodeStopped = errcode.Register(errGroup, errcode.ErrorDescriptor{
  489. Value: "STOPPED",
  490. Message: "Container %s is already stopped",
  491. Description: "An attempt was made to stop a container, but the container is already stopped",
  492. HTTPStatusCode: http.StatusNotModified,
  493. })
  494. // ErrorCodeCantStop is generated when we try to stop a container
  495. // but failed for some reason.
  496. ErrorCodeCantStop = errcode.Register(errGroup, errcode.ErrorDescriptor{
  497. Value: "CANTSTOP",
  498. Message: "Cannot stop container %s: %s\n",
  499. Description: "An error occurred while tring to stop the specified container",
  500. HTTPStatusCode: http.StatusInternalServerError,
  501. })
  502. // ErrorCodeBadCPUFields is generated when the number of CPU fields is
  503. // less than 8.
  504. ErrorCodeBadCPUFields = errcode.Register(errGroup, errcode.ErrorDescriptor{
  505. Value: "BADCPUFIELDS",
  506. Message: "invalid number of cpu fields",
  507. Description: "While reading the '/proc/stat' file, the number of 'cpu' fields is less than 8",
  508. HTTPStatusCode: http.StatusInternalServerError,
  509. })
  510. // ErrorCodeBadCPUInt is generated the CPU field can't be parsed as an int.
  511. ErrorCodeBadCPUInt = errcode.Register(errGroup, errcode.ErrorDescriptor{
  512. Value: "BADCPUINT",
  513. Message: "Unable to convert value %s to int: %s",
  514. Description: "While reading the '/proc/stat' file, the 'CPU' field could not be parsed as an integer",
  515. HTTPStatusCode: http.StatusInternalServerError,
  516. })
  517. // ErrorCodeBadStatFormat is generated the output of the stat info
  518. // isn't parseable.
  519. ErrorCodeBadStatFormat = errcode.Register(errGroup, errcode.ErrorDescriptor{
  520. Value: "BADSTATFORMAT",
  521. Message: "invalid stat format",
  522. Description: "There was an error trying to parse the '/proc/stat' file",
  523. HTTPStatusCode: http.StatusInternalServerError,
  524. })
  525. // ErrorCodeTimedOut is generated when a timer expires.
  526. ErrorCodeTimedOut = errcode.Register(errGroup, errcode.ErrorDescriptor{
  527. Value: "TIMEDOUT",
  528. Message: "Timed out: %v",
  529. Description: "A timer expired",
  530. HTTPStatusCode: http.StatusInternalServerError,
  531. })
  532. // ErrorCodeAlreadyRemoving is generated when we try to remove a
  533. // container that is already being removed.
  534. ErrorCodeAlreadyRemoving = errcode.Register(errGroup, errcode.ErrorDescriptor{
  535. Value: "ALREADYREMOVING",
  536. Message: "Status is already RemovalInProgress",
  537. Description: "An attempt to remove a container was made, but the container is already in the process of being removed",
  538. HTTPStatusCode: http.StatusInternalServerError,
  539. })
  540. // ErrorCodeStartPaused is generated when we start a paused container.
  541. ErrorCodeStartPaused = errcode.Register(errGroup, errcode.ErrorDescriptor{
  542. Value: "STARTPAUSED",
  543. Message: "Cannot start a paused container, try unpause instead.",
  544. Description: "An attempt to start a container was made, but the container is paused. Unpause it first",
  545. HTTPStatusCode: http.StatusInternalServerError,
  546. })
  547. // ErrorCodeAlreadyStarted is generated when we try to start a container
  548. // that is already running.
  549. ErrorCodeAlreadyStarted = errcode.Register(errGroup, errcode.ErrorDescriptor{
  550. Value: "ALREADYSTARTED",
  551. Message: "Container already started",
  552. Description: "An attempt to start a container was made, but the container is already started",
  553. HTTPStatusCode: http.StatusNotModified,
  554. })
  555. // ErrorCodeHostConfigStart is generated when a HostConfig is passed
  556. // into the start command.
  557. ErrorCodeHostConfigStart = errcode.Register(errGroup, errcode.ErrorDescriptor{
  558. Value: "HOSTCONFIGSTART",
  559. Message: "Supplying a hostconfig on start is not supported. It should be supplied on create",
  560. Description: "The 'start' command does not accept 'HostConfig' data, try using the 'create' command instead",
  561. HTTPStatusCode: http.StatusInternalServerError,
  562. })
  563. // ErrorCodeCantRestart is generated when an error occurred while
  564. // trying to restart a container.
  565. ErrorCodeCantRestart = errcode.Register(errGroup, errcode.ErrorDescriptor{
  566. Value: "CANTRESTART",
  567. Message: "Cannot restart container %s: %s",
  568. Description: "There was an error while trying to restart a container",
  569. HTTPStatusCode: http.StatusInternalServerError,
  570. })
  571. // ErrorCodeEmptyRename is generated when one of the names on a
  572. // rename is empty.
  573. ErrorCodeEmptyRename = errcode.Register(errGroup, errcode.ErrorDescriptor{
  574. Value: "EMPTYRENAME",
  575. Message: "Neither old nor new names may be empty",
  576. Description: "An attempt was made to rename a container but either the old or new names were blank",
  577. HTTPStatusCode: http.StatusInternalServerError,
  578. })
  579. // ErrorCodeRenameTaken is generated when we try to rename but the
  580. // new name isn't available.
  581. ErrorCodeRenameTaken = errcode.Register(errGroup, errcode.ErrorDescriptor{
  582. Value: "RENAMETAKEN",
  583. Message: "Error when allocating new name: %s",
  584. Description: "The new name specified on the 'rename' command is already being used",
  585. HTTPStatusCode: http.StatusInternalServerError,
  586. })
  587. // ErrorCodeRenameDelete is generated when we try to rename but
  588. // failed trying to delete the old container.
  589. ErrorCodeRenameDelete = errcode.Register(errGroup, errcode.ErrorDescriptor{
  590. Value: "RENAMEDELETE",
  591. Message: "Failed to delete container %q: %v",
  592. Description: "There was an error trying to delete the specified container",
  593. HTTPStatusCode: http.StatusInternalServerError,
  594. })
  595. // ErrorCodePauseError is generated when we try to pause a container
  596. // but failed.
  597. ErrorCodePauseError = errcode.Register(errGroup, errcode.ErrorDescriptor{
  598. Value: "PAUSEERROR",
  599. Message: "Cannot pause container %s: %s",
  600. Description: "There was an error trying to pause the specified container",
  601. HTTPStatusCode: http.StatusInternalServerError,
  602. })
  603. // ErrorCodeNeedStream is generated when we try to stream a container's
  604. // logs but no output stream was specified.
  605. ErrorCodeNeedStream = errcode.Register(errGroup, errcode.ErrorDescriptor{
  606. Value: "NEEDSTREAM",
  607. Message: "You must choose at least one stream",
  608. Description: "While trying to stream a container's logs, no output stream was specified",
  609. HTTPStatusCode: http.StatusInternalServerError,
  610. })
  611. // ErrorCodeDanglingOne is generated when we try to specify more than one
  612. // 'dangling' specifier.
  613. ErrorCodeDanglingOne = errcode.Register(errGroup, errcode.ErrorDescriptor{
  614. Value: "DANLGINGONE",
  615. Message: "Conflict: cannot use more than 1 value for `dangling` filter",
  616. Description: "The specified 'dangling' filter may not have more than one value",
  617. HTTPStatusCode: http.StatusConflict,
  618. })
  619. // ErrorCodeImgDelUsed is generated when we try to delete an image
  620. // but it is being used.
  621. ErrorCodeImgDelUsed = errcode.Register(errGroup, errcode.ErrorDescriptor{
  622. Value: "IMGDELUSED",
  623. Message: "conflict: unable to remove repository reference %q (must force) - container %s is using its referenced image %s",
  624. Description: "An attempt was made to delete an image but it is currently being used",
  625. HTTPStatusCode: http.StatusConflict,
  626. })
  627. // ErrorCodeImgNoParent is generated when we try to find an image's
  628. // parent but its not in the graph.
  629. ErrorCodeImgNoParent = errcode.Register(errGroup, errcode.ErrorDescriptor{
  630. Value: "IMGNOPARENT",
  631. Message: "unable to get parent image: %v",
  632. Description: "There was an error trying to find an image's parent, it was not in the graph",
  633. HTTPStatusCode: http.StatusInternalServerError,
  634. })
  635. // ErrorCodeExportFailed is generated when an export fails.
  636. ErrorCodeExportFailed = errcode.Register(errGroup, errcode.ErrorDescriptor{
  637. Value: "EXPORTFAILED",
  638. Message: "%s: %s",
  639. Description: "There was an error during an export operation",
  640. HTTPStatusCode: http.StatusInternalServerError,
  641. })
  642. // ErrorCodeExecResize is generated when we try to resize an exec
  643. // but its not running.
  644. ErrorCodeExecResize = errcode.Register(errGroup, errcode.ErrorDescriptor{
  645. Value: "EXECRESIZE",
  646. Message: "Exec %s is not running, so it can not be resized.",
  647. Description: "An attempt was made to resize an 'exec', but the 'exec' is not running",
  648. HTTPStatusCode: http.StatusInternalServerError,
  649. })
  650. // ErrorCodeContainerNotRunning is generated when we try to get the info
  651. // on an exec but the container is not running.
  652. ErrorCodeContainerNotRunning = errcode.Register(errGroup, errcode.ErrorDescriptor{
  653. Value: "CONTAINERNOTRUNNING",
  654. Message: "Container %s is not running: %s",
  655. Description: "An attempt was made to retrieve the information about an 'exec' but the container is not running",
  656. HTTPStatusCode: http.StatusConflict,
  657. })
  658. // ErrorCodeContainerRestarting is generated when an operation was made
  659. // on a restarting container.
  660. ErrorCodeContainerRestarting = errcode.Register(errGroup, errcode.ErrorDescriptor{
  661. Value: "CONTAINERRESTARTING",
  662. Message: "Container %s is restarting, wait until the container is running",
  663. Description: "An operation was made on a restarting container",
  664. HTTPStatusCode: http.StatusConflict,
  665. })
  666. // ErrorCodeNoExecID is generated when we try to get the info
  667. // on an exec but it can't be found.
  668. ErrorCodeNoExecID = errcode.Register(errGroup, errcode.ErrorDescriptor{
  669. Value: "NOEXECID",
  670. Message: "No such exec instance '%s' found in daemon",
  671. Description: "The specified 'exec' instance could not be found",
  672. HTTPStatusCode: http.StatusNotFound,
  673. })
  674. // ErrorCodeExecPaused is generated when we try to start an exec
  675. // but the container is paused.
  676. ErrorCodeExecPaused = errcode.Register(errGroup, errcode.ErrorDescriptor{
  677. Value: "EXECPAUSED",
  678. Message: "Container %s is paused, unpause the container before exec",
  679. Description: "An attempt to start an 'exec' was made, but the owning container is paused",
  680. HTTPStatusCode: http.StatusConflict,
  681. })
  682. // ErrorCodeExecRunning is generated when we try to start an exec
  683. // but its already running.
  684. ErrorCodeExecRunning = errcode.Register(errGroup, errcode.ErrorDescriptor{
  685. Value: "EXECRUNNING",
  686. Message: "Error: Exec command %s is already running",
  687. Description: "An attempt to start an 'exec' was made, but 'exec' is already running",
  688. HTTPStatusCode: http.StatusInternalServerError,
  689. })
  690. // ErrorCodeExecExited is generated when we try to start an exec
  691. // but its already running.
  692. ErrorCodeExecExited = errcode.Register(errGroup, errcode.ErrorDescriptor{
  693. Value: "EXECEXITED",
  694. Message: "Error: Exec command %s has already run",
  695. Description: "An attempt to start an 'exec' was made, but 'exec' was already run",
  696. HTTPStatusCode: http.StatusConflict,
  697. })
  698. // ErrorCodeExecCantRun is generated when we try to start an exec
  699. // but it failed for some reason.
  700. ErrorCodeExecCantRun = errcode.Register(errGroup, errcode.ErrorDescriptor{
  701. Value: "EXECCANTRUN",
  702. Message: "Cannot run exec command %s in container %s: %s",
  703. Description: "An attempt to start an 'exec' was made, but an error occurred",
  704. HTTPStatusCode: http.StatusInternalServerError,
  705. })
  706. // ErrorCodeExecAttach is generated when we try to attach to an exec
  707. // but failed.
  708. ErrorCodeExecAttach = errcode.Register(errGroup, errcode.ErrorDescriptor{
  709. Value: "EXECATTACH",
  710. Message: "attach failed with error: %s",
  711. Description: "There was an error while trying to attach to an 'exec'",
  712. HTTPStatusCode: http.StatusInternalServerError,
  713. })
  714. // ErrorCodeExecContainerStopped is generated when we try to start
  715. // an exec but then the container stopped.
  716. ErrorCodeExecContainerStopped = errcode.Register(errGroup, errcode.ErrorDescriptor{
  717. Value: "EXECCONTAINERSTOPPED",
  718. Message: "container stopped while running exec",
  719. Description: "An attempt was made to start an 'exec' but the owning container is in the 'stopped' state",
  720. HTTPStatusCode: http.StatusInternalServerError,
  721. })
  722. // ErrorCodeDefaultName is generated when we try to delete the
  723. // default name of a container.
  724. ErrorCodeDefaultName = errcode.Register(errGroup, errcode.ErrorDescriptor{
  725. Value: "DEFAULTNAME",
  726. Message: "Conflict, cannot remove the default name of the container",
  727. Description: "An attempt to delete the default name of a container was made, but that is not allowed",
  728. HTTPStatusCode: http.StatusConflict,
  729. })
  730. // ErrorCodeNoParent is generated when we try to delete a container
  731. // but we can't find its parent image.
  732. ErrorCodeNoParent = errcode.Register(errGroup, errcode.ErrorDescriptor{
  733. Value: "NOPARENT",
  734. Message: "Cannot get parent %s for name %s",
  735. Description: "An attempt was made to delete a container but its parent image could not be found",
  736. HTTPStatusCode: http.StatusInternalServerError,
  737. })
  738. // ErrorCodeCantDestroy is generated when we try to delete a container
  739. // but failed for some reason.
  740. ErrorCodeCantDestroy = errcode.Register(errGroup, errcode.ErrorDescriptor{
  741. Value: "CANTDESTROY",
  742. Message: "Cannot destroy container %s: %v",
  743. Description: "An attempt was made to delete a container but it failed",
  744. HTTPStatusCode: http.StatusInternalServerError,
  745. })
  746. // ErrorCodeRmRunning is generated when we try to delete a container
  747. // but its still running.
  748. ErrorCodeRmRunning = errcode.Register(errGroup, errcode.ErrorDescriptor{
  749. Value: "RMRUNNING",
  750. Message: "You cannot remove a running container %s. Stop the container before attempting removal or use -f",
  751. Description: "An attempt was made to delete a container but the container is still running, try to either stop it first or use '-f'",
  752. HTTPStatusCode: http.StatusConflict,
  753. })
  754. // ErrorCodeRmFailed is generated when we try to delete a container
  755. // but it failed for some reason.
  756. ErrorCodeRmFailed = errcode.Register(errGroup, errcode.ErrorDescriptor{
  757. Value: "RMFAILED",
  758. Message: "Could not kill running container %s, cannot remove - %v",
  759. Description: "An error occurred while trying to delete a running container",
  760. HTTPStatusCode: http.StatusInternalServerError,
  761. })
  762. // ErrorCodeRmNotFound is generated when we try to delete a container
  763. // but couldn't find it.
  764. ErrorCodeRmNotFound = errcode.Register(errGroup, errcode.ErrorDescriptor{
  765. Value: "RMNOTFOUND",
  766. Message: "Could not kill running container, cannot remove - %v",
  767. Description: "An attempt to delete a container was made but the container could not be found",
  768. HTTPStatusCode: http.StatusInternalServerError,
  769. })
  770. // ErrorCodeRmState is generated when we try to delete a container
  771. // but couldn't set its state to RemovalInProgress.
  772. ErrorCodeRmState = errcode.Register(errGroup, errcode.ErrorDescriptor{
  773. Value: "RMSTATE",
  774. Message: "Failed to set container %s state to RemovalInProgress: %s",
  775. Description: "An attempt to delete a container was made, but there as an error trying to set its state to 'RemovalInProgress'",
  776. HTTPStatusCode: http.StatusInternalServerError,
  777. })
  778. // ErrorCodeRmDriverFS is generated when we try to delete a container
  779. // but the driver failed to delete its filesystem.
  780. ErrorCodeRmDriverFS = errcode.Register(errGroup, errcode.ErrorDescriptor{
  781. Value: "RMDRIVERFS",
  782. Message: "Driver %s failed to remove root filesystem %s: %s",
  783. Description: "While trying to delete a container, the driver failed to remove the root filesystem",
  784. HTTPStatusCode: http.StatusInternalServerError,
  785. })
  786. // ErrorCodeRmFS is generated when we try to delete a container
  787. // but failed deleting its filesystem.
  788. ErrorCodeRmFS = errcode.Register(errGroup, errcode.ErrorDescriptor{
  789. Value: "RMFS",
  790. Message: "Unable to remove filesystem for %v: %v",
  791. Description: "While trying to delete a container, the driver failed to remove the filesystem",
  792. HTTPStatusCode: http.StatusInternalServerError,
  793. })
  794. // ErrorCodeRmExecDriver is generated when we try to delete a container
  795. // but failed deleting its exec driver data.
  796. ErrorCodeRmExecDriver = errcode.Register(errGroup, errcode.ErrorDescriptor{
  797. Value: "RMEXECDRIVER",
  798. Message: "Unable to remove execdriver data for %s: %s",
  799. Description: "While trying to delete a container, there was an error trying to remove th exec driver data",
  800. HTTPStatusCode: http.StatusInternalServerError,
  801. })
  802. // ErrorCodeRmVolumeInUse is generated when we try to delete a container
  803. // but failed deleting a volume because its being used.
  804. ErrorCodeRmVolumeInUse = errcode.Register(errGroup, errcode.ErrorDescriptor{
  805. Value: "RMVOLUMEINUSE",
  806. Message: "Conflict: %v",
  807. Description: "While trying to delete a container, one of its volumes is still being used",
  808. HTTPStatusCode: http.StatusConflict,
  809. })
  810. // ErrorCodeRmVolume is generated when we try to delete a container
  811. // but failed deleting a volume.
  812. ErrorCodeRmVolume = errcode.Register(errGroup, errcode.ErrorDescriptor{
  813. Value: "RMVOLUME",
  814. Message: "Error while removing volume %s: %v",
  815. Description: "While trying to delete a container, there was an error trying to delete one of its volumes",
  816. HTTPStatusCode: http.StatusInternalServerError,
  817. })
  818. // ErrorCodeInvalidCpusetCpus is generated when user provided cpuset CPUs
  819. // are invalid.
  820. ErrorCodeInvalidCpusetCpus = errcode.Register(errGroup, errcode.ErrorDescriptor{
  821. Value: "INVALIDCPUSETCPUS",
  822. Message: "Invalid value %s for cpuset cpus.",
  823. Description: "While verifying the container's 'HostConfig', CpusetCpus value was in an incorrect format",
  824. HTTPStatusCode: http.StatusInternalServerError,
  825. })
  826. // ErrorCodeInvalidCpusetMems is generated when user provided cpuset mems
  827. // are invalid.
  828. ErrorCodeInvalidCpusetMems = errcode.Register(errGroup, errcode.ErrorDescriptor{
  829. Value: "INVALIDCPUSETMEMS",
  830. Message: "Invalid value %s for cpuset mems.",
  831. Description: "While verifying the container's 'HostConfig', CpusetMems value was in an incorrect format",
  832. HTTPStatusCode: http.StatusInternalServerError,
  833. })
  834. // ErrorCodeNotAvailableCpusetCpus is generated when user provided cpuset
  835. // CPUs aren't available in the container's cgroup.
  836. ErrorCodeNotAvailableCpusetCpus = errcode.Register(errGroup, errcode.ErrorDescriptor{
  837. Value: "NOTAVAILABLECPUSETCPUS",
  838. Message: "Requested CPUs are not available - requested %s, available: %s.",
  839. Description: "While verifying the container's 'HostConfig', cpuset CPUs provided aren't available in the container's cgroup available set",
  840. HTTPStatusCode: http.StatusInternalServerError,
  841. })
  842. // ErrorCodeNotAvailableCpusetMems is generated when user provided cpuset
  843. // memory nodes aren't available in the container's cgroup.
  844. ErrorCodeNotAvailableCpusetMems = errcode.Register(errGroup, errcode.ErrorDescriptor{
  845. Value: "NOTAVAILABLECPUSETMEMS",
  846. Message: "Requested memory nodes are not available - requested %s, available: %s.",
  847. Description: "While verifying the container's 'HostConfig', cpuset memory nodes provided aren't available in the container's cgroup available set",
  848. HTTPStatusCode: http.StatusInternalServerError,
  849. })
  850. // ErrorVolumeNameTaken is generated when an error occurred while
  851. // trying to create a volume that has existed using different driver.
  852. ErrorVolumeNameTaken = errcode.Register(errGroup, errcode.ErrorDescriptor{
  853. Value: "VOLUME_NAME_TAKEN",
  854. Message: "A volume named %s already exists. Choose a different volume name.",
  855. Description: "An attempt to create a volume using a driver but the volume already exists with a different driver",
  856. HTTPStatusCode: http.StatusInternalServerError,
  857. })
  858. // ErrorCodeCmdNotFound is generated when container cmd can't start,
  859. // container command not found error, exit code 127
  860. ErrorCodeCmdNotFound = errcode.Register(errGroup, errcode.ErrorDescriptor{
  861. Value: "CMDNOTFOUND",
  862. Message: "Container command not found or does not exist.",
  863. Description: "Command could not be found, command does not exist",
  864. HTTPStatusCode: http.StatusInternalServerError,
  865. })
  866. // ErrorCodeCmdCouldNotBeInvoked is generated when container cmd can't start,
  867. // container command permission denied error, exit code 126
  868. ErrorCodeCmdCouldNotBeInvoked = errcode.Register(errGroup, errcode.ErrorDescriptor{
  869. Value: "CMDCOULDNOTBEINVOKED",
  870. Message: "Container command could not be invoked.",
  871. Description: "Permission denied, cannot invoke command",
  872. HTTPStatusCode: http.StatusInternalServerError,
  873. })
  874. // ErrorCodeCantStart is generated when container cmd can't start,
  875. // for any reason other than above 2 errors
  876. ErrorCodeCantStart = errcode.Register(errGroup, errcode.ErrorDescriptor{
  877. Value: "CANTSTART",
  878. Message: "Cannot start container %s: %s",
  879. Description: "There was an error while trying to start a container",
  880. HTTPStatusCode: http.StatusInternalServerError,
  881. })
  882. // ErrorCodeCantDeletePredefinedNetwork is generated when one of the predefined networks
  883. // is attempted to be deleted.
  884. ErrorCodeCantDeletePredefinedNetwork = errcode.Register(errGroup, errcode.ErrorDescriptor{
  885. Value: "CANT_DELETE_PREDEFINED_NETWORK",
  886. Message: "%s is a pre-defined network and cannot be removed",
  887. Description: "Engine's predefined networks cannot be deleted",
  888. HTTPStatusCode: http.StatusForbidden,
  889. })
  890. // ErrorCodeMultipleNetworkConnect is generated when more than one network is passed
  891. // when creating a container
  892. ErrorCodeMultipleNetworkConnect = errcode.Register(errGroup, errcode.ErrorDescriptor{
  893. Value: "CANNOT_CONNECT_TO_MULTIPLE_NETWORKS",
  894. Message: "Container cannot be connected to %s",
  895. Description: "A container can only be connected to one network at the time",
  896. HTTPStatusCode: http.StatusBadRequest,
  897. })
  898. )