daemon.go 40 KB

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