github.com/mheon/docker@v0.11.2-0.20150922122814-44f47903a831/errors/daemon.go (about) 1 package errors 2 3 // This file contains all of the errors that can be generated from the 4 // docker/daemon component. 5 6 import ( 7 "net/http" 8 9 "github.com/docker/distribution/registry/api/errcode" 10 ) 11 12 var ( 13 // ErrorCodeNoSuchContainer is generated when we look for a container by 14 // name or ID and we can't find it. 15 ErrorCodeNoSuchContainer = errcode.Register(errGroup, errcode.ErrorDescriptor{ 16 Value: "NOSUCHCONTAINER", 17 Message: "no such id: %s", 18 Description: "The specified container can not be found", 19 HTTPStatusCode: http.StatusNotFound, 20 }) 21 22 // ErrorCodeUnregisteredContainer is generated when we try to load 23 // a storage driver for an unregistered container 24 ErrorCodeUnregisteredContainer = errcode.Register(errGroup, errcode.ErrorDescriptor{ 25 Value: "UNREGISTEREDCONTAINER", 26 Message: "Can't load storage driver for unregistered container %s", 27 HTTPStatusCode: http.StatusInternalServerError, 28 }) 29 30 // ErrorCodeContainerBeingRemoved is generated when an attempt to start 31 // a container is made but its in the process of being removed, or is dead. 32 ErrorCodeContainerBeingRemoved = errcode.Register(errGroup, errcode.ErrorDescriptor{ 33 Value: "CONTAINERBEINGREMOVED", 34 Message: "Container is marked for removal and cannot be started.", 35 HTTPStatusCode: http.StatusInternalServerError, 36 }) 37 38 // ErrorCodeUnpauseContainer is generated when we attempt to stop a 39 // container but its paused. 40 ErrorCodeUnpauseContainer = errcode.Register(errGroup, errcode.ErrorDescriptor{ 41 Value: "UNPAUSECONTAINER", 42 Message: "Container %s is paused. Unpause the container before stopping", 43 HTTPStatusCode: http.StatusInternalServerError, 44 }) 45 46 // ErrorCodeAlreadyPaused is generated when we attempt to pause a 47 // container when its already paused. 48 ErrorCodeAlreadyPaused = errcode.Register(errGroup, errcode.ErrorDescriptor{ 49 Value: "ALREADYPAUSED", 50 Message: "Container %s is already paused", 51 HTTPStatusCode: http.StatusInternalServerError, 52 }) 53 54 // ErrorCodeNotPaused is generated when we attempt to unpause a 55 // container when its not paused. 56 ErrorCodeNotPaused = errcode.Register(errGroup, errcode.ErrorDescriptor{ 57 Value: "NOTPAUSED", 58 Message: "Container %s is not paused", 59 HTTPStatusCode: http.StatusInternalServerError, 60 }) 61 62 // ErrorCodeImageUnregContainer is generated when we attempt to get the 63 // image of an unknown/unregistered container. 64 ErrorCodeImageUnregContainer = errcode.Register(errGroup, errcode.ErrorDescriptor{ 65 Value: "IMAGEUNREGCONTAINER", 66 Message: "Can't get image of unregistered container", 67 HTTPStatusCode: http.StatusInternalServerError, 68 }) 69 70 // ErrorCodeEmptyID is generated when an ID is the emptry string. 71 ErrorCodeEmptyID = errcode.Register(errGroup, errcode.ErrorDescriptor{ 72 Value: "EMPTYID", 73 Message: "Invalid empty id", 74 HTTPStatusCode: http.StatusInternalServerError, 75 }) 76 77 // ErrorCodeLoggingFactory is generated when we could not load the 78 // log driver. 79 ErrorCodeLoggingFactory = errcode.Register(errGroup, errcode.ErrorDescriptor{ 80 Value: "LOGGINGFACTORY", 81 Message: "Failed to get logging factory: %v", 82 HTTPStatusCode: http.StatusInternalServerError, 83 }) 84 85 // ErrorCodeInitLogger is generated when we could not initialize 86 // the logging driver. 87 ErrorCodeInitLogger = errcode.Register(errGroup, errcode.ErrorDescriptor{ 88 Value: "INITLOGGER", 89 Message: "Failed to initialize logging driver: %v", 90 HTTPStatusCode: http.StatusInternalServerError, 91 }) 92 93 // ErrorCodeNotRunning is generated when we need to verify that 94 // a container is running, but its not. 95 ErrorCodeNotRunning = errcode.Register(errGroup, errcode.ErrorDescriptor{ 96 Value: "NOTRUNNING", 97 Message: "Container %s is not running", 98 HTTPStatusCode: http.StatusInternalServerError, 99 }) 100 101 // ErrorCodeLinkNotRunning is generated when we try to link to a 102 // container that is not running. 103 ErrorCodeLinkNotRunning = errcode.Register(errGroup, errcode.ErrorDescriptor{ 104 Value: "LINKNOTRUNNING", 105 Message: "Cannot link to a non running container: %s AS %s", 106 HTTPStatusCode: http.StatusInternalServerError, 107 }) 108 109 // ErrorCodeDeviceInfo is generated when there is an error while trying 110 // to get info about a custom device. 111 // container that is not running. 112 ErrorCodeDeviceInfo = errcode.Register(errGroup, errcode.ErrorDescriptor{ 113 Value: "DEVICEINFO", 114 Message: "error gathering device information while adding custom device %q: %s", 115 HTTPStatusCode: http.StatusInternalServerError, 116 }) 117 118 // ErrorCodeEmptyEndpoint is generated when the endpoint for a port 119 // map is nil. 120 ErrorCodeEmptyEndpoint = errcode.Register(errGroup, errcode.ErrorDescriptor{ 121 Value: "EMPTYENDPOINT", 122 Message: "invalid endpoint while building port map info", 123 HTTPStatusCode: http.StatusInternalServerError, 124 }) 125 126 // ErrorCodeEmptyNetwork is generated when the networkSettings for a port 127 // map is nil. 128 ErrorCodeEmptyNetwork = errcode.Register(errGroup, errcode.ErrorDescriptor{ 129 Value: "EMPTYNETWORK", 130 Message: "invalid networksettings while building port map info", 131 HTTPStatusCode: http.StatusInternalServerError, 132 }) 133 134 // ErrorCodeParsingPort is generated when there is an error parsing 135 // a "port" string. 136 ErrorCodeParsingPort = errcode.Register(errGroup, errcode.ErrorDescriptor{ 137 Value: "PARSINGPORT", 138 Message: "Error parsing Port value(%v):%v", 139 HTTPStatusCode: http.StatusInternalServerError, 140 }) 141 142 // ErrorCodeNoSandbox is generated when we can't find the specified 143 // sandbox(network) by ID. 144 ErrorCodeNoSandbox = errcode.Register(errGroup, errcode.ErrorDescriptor{ 145 Value: "NOSANDBOX", 146 Message: "error locating sandbox id %s: %v", 147 HTTPStatusCode: http.StatusInternalServerError, 148 }) 149 150 // ErrorCodeNetworkUpdate is generated when there is an error while 151 // trying update a network/sandbox config. 152 ErrorCodeNetworkUpdate = errcode.Register(errGroup, errcode.ErrorDescriptor{ 153 Value: "NETWORKUPDATE", 154 Message: "Update network failed: %v", 155 HTTPStatusCode: http.StatusInternalServerError, 156 }) 157 158 // ErrorCodeNetworkRefresh is generated when there is an error while 159 // trying refresh a network/sandbox config. 160 ErrorCodeNetworkRefresh = errcode.Register(errGroup, errcode.ErrorDescriptor{ 161 Value: "NETWORKREFRESH", 162 Message: "Update network failed: Failure in refresh sandbox %s: %v", 163 HTTPStatusCode: http.StatusInternalServerError, 164 }) 165 166 // ErrorCodeHostPort is generated when there was an error while trying 167 // to parse a "host/por" string. 168 ErrorCodeHostPort = errcode.Register(errGroup, errcode.ErrorDescriptor{ 169 Value: "HOSTPORT", 170 Message: "Error parsing HostPort value(%s):%v", 171 HTTPStatusCode: http.StatusInternalServerError, 172 }) 173 174 // ErrorCodeNetworkConflict is generated when we try to public a service 175 // in network mode. 176 ErrorCodeNetworkConflict = errcode.Register(errGroup, errcode.ErrorDescriptor{ 177 Value: "NETWORKCONFLICT", 178 Message: "conflicting options: publishing a service and network mode", 179 HTTPStatusCode: http.StatusConflict, 180 }) 181 182 // ErrorCodeJoinInfo is generated when we failed to update a container's 183 // join info. 184 ErrorCodeJoinInfo = errcode.Register(errGroup, errcode.ErrorDescriptor{ 185 Value: "JOININFO", 186 Message: "Updating join info failed: %v", 187 HTTPStatusCode: http.StatusInternalServerError, 188 }) 189 190 // ErrorCodeIPCRunning is generated when we try to join a container's 191 // IPC but its running. 192 ErrorCodeIPCRunning = errcode.Register(errGroup, errcode.ErrorDescriptor{ 193 Value: "IPCRUNNING", 194 Message: "cannot join IPC of a non running container: %s", 195 HTTPStatusCode: http.StatusInternalServerError, 196 }) 197 198 // ErrorCodeNotADir is generated when we try to create a directory 199 // but the path isn't a dir. 200 ErrorCodeNotADir = errcode.Register(errGroup, errcode.ErrorDescriptor{ 201 Value: "NOTADIR", 202 Message: "Cannot mkdir: %s is not a directory", 203 HTTPStatusCode: http.StatusInternalServerError, 204 }) 205 206 // ErrorCodeParseContainer is generated when the reference to a 207 // container doesn't include a ":" (another container). 208 ErrorCodeParseContainer = errcode.Register(errGroup, errcode.ErrorDescriptor{ 209 Value: "PARSECONTAINER", 210 Message: "no container specified to join network", 211 HTTPStatusCode: http.StatusInternalServerError, 212 }) 213 214 // ErrorCodeJoinSelf is generated when we try to network to ourselves. 215 ErrorCodeJoinSelf = errcode.Register(errGroup, errcode.ErrorDescriptor{ 216 Value: "JOINSELF", 217 Message: "cannot join own network", 218 HTTPStatusCode: http.StatusInternalServerError, 219 }) 220 221 // ErrorCodeJoinRunning is generated when we try to network to ourselves. 222 ErrorCodeJoinRunning = errcode.Register(errGroup, errcode.ErrorDescriptor{ 223 Value: "JOINRUNNING", 224 Message: "cannot join network of a non running container: %s", 225 HTTPStatusCode: http.StatusInternalServerError, 226 }) 227 228 // ErrorCodeModeNotContainer is generated when we try to network to 229 // another container but the mode isn't 'container'. 230 ErrorCodeModeNotContainer = errcode.Register(errGroup, errcode.ErrorDescriptor{ 231 Value: "MODENOTCONTAINER", 232 Message: "network mode not set to container", 233 HTTPStatusCode: http.StatusInternalServerError, 234 }) 235 236 // ErrorCodeRemovingVolume is generated when we try remove a mount 237 // point (volume) but fail. 238 ErrorCodeRemovingVolume = errcode.Register(errGroup, errcode.ErrorDescriptor{ 239 Value: "REMOVINGVOLUME", 240 Message: "Error removing volumes:\n%v", 241 HTTPStatusCode: http.StatusInternalServerError, 242 }) 243 244 // ErrorCodeInvalidNetworkMode is generated when an invalid network 245 // mode value is specified. 246 ErrorCodeInvalidNetworkMode = errcode.Register(errGroup, errcode.ErrorDescriptor{ 247 Value: "INVALIDNETWORKMODE", 248 Message: "invalid network mode: %s", 249 HTTPStatusCode: http.StatusInternalServerError, 250 }) 251 252 // ErrorCodeGetGraph is generated when there was an error while 253 // trying to find a graph/image. 254 ErrorCodeGetGraph = errcode.Register(errGroup, errcode.ErrorDescriptor{ 255 Value: "GETGRAPH", 256 Message: "Failed to graph.Get on ImageID %s - %s", 257 HTTPStatusCode: http.StatusInternalServerError, 258 }) 259 260 // ErrorCodeGetLayer is generated when there was an error while 261 // trying to retrieve a particular layer of an image. 262 ErrorCodeGetLayer = errcode.Register(errGroup, errcode.ErrorDescriptor{ 263 Value: "GETLAYER", 264 Message: "Failed to get layer path from graphdriver %s for ImageID %s - %s", 265 HTTPStatusCode: http.StatusInternalServerError, 266 }) 267 268 // ErrorCodePutLayer is generated when there was an error while 269 // trying to 'put' a particular layer of an image. 270 ErrorCodePutLayer = errcode.Register(errGroup, errcode.ErrorDescriptor{ 271 Value: "PUTLAYER", 272 Message: "Failed to put layer path from graphdriver %s for ImageID %s - %s", 273 HTTPStatusCode: http.StatusInternalServerError, 274 }) 275 276 // ErrorCodeGetLayerMetadata is generated when there was an error while 277 // trying to retrieve the metadata of a layer of an image. 278 ErrorCodeGetLayerMetadata = errcode.Register(errGroup, errcode.ErrorDescriptor{ 279 Value: "GETLAYERMETADATA", 280 Message: "Failed to get layer metadata - %s", 281 HTTPStatusCode: http.StatusInternalServerError, 282 }) 283 284 // ErrorCodeEmptyConfig is generated when the input config data 285 // is empty. 286 ErrorCodeEmptyConfig = errcode.Register(errGroup, errcode.ErrorDescriptor{ 287 Value: "EMPTYCONFIG", 288 Message: "Config cannot be empty in order to create a container", 289 HTTPStatusCode: http.StatusInternalServerError, 290 }) 291 292 // ErrorCodeNoSuchImageHash is generated when we can't find the 293 // specified image by its hash 294 ErrorCodeNoSuchImageHash = errcode.Register(errGroup, errcode.ErrorDescriptor{ 295 Value: "NOSUCHIMAGEHASH", 296 Message: "No such image: %s", 297 HTTPStatusCode: http.StatusNotFound, 298 }) 299 300 // ErrorCodeNoSuchImageTag is generated when we can't find the 301 // specified image byt its name/tag. 302 ErrorCodeNoSuchImageTag = errcode.Register(errGroup, errcode.ErrorDescriptor{ 303 Value: "NOSUCHIMAGETAG", 304 Message: "No such image: %s:%s", 305 HTTPStatusCode: http.StatusNotFound, 306 }) 307 308 // ErrorCodeMountOverFile is generated when we try to mount a volume 309 // over an existing file (but not a dir). 310 ErrorCodeMountOverFile = errcode.Register(errGroup, errcode.ErrorDescriptor{ 311 Value: "MOUNTOVERFILE", 312 Message: "cannot mount volume over existing file, file exists %s", 313 HTTPStatusCode: http.StatusInternalServerError, 314 }) 315 316 // ErrorCodeMountSetup is generated when we can't define a mount point 317 // due to the source and destination are defined. 318 ErrorCodeMountSetup = errcode.Register(errGroup, errcode.ErrorDescriptor{ 319 Value: "MOUNTSETUP", 320 Message: "Unable to setup mount point, neither source nor volume defined", 321 HTTPStatusCode: http.StatusInternalServerError, 322 }) 323 324 // ErrorCodeVolumeInvalidMode is generated when we the mode of a volume 325 // mount is invalid. 326 ErrorCodeVolumeInvalidMode = errcode.Register(errGroup, errcode.ErrorDescriptor{ 327 Value: "VOLUMEINVALIDMODE", 328 Message: "invalid mode for volumes-from: %s", 329 HTTPStatusCode: http.StatusInternalServerError, 330 }) 331 332 // ErrorCodeVolumeInvalid is generated when the format fo the 333 // volume specification isn't valid. 334 ErrorCodeVolumeInvalid = errcode.Register(errGroup, errcode.ErrorDescriptor{ 335 Value: "VOLUMEINVALID", 336 Message: "Invalid volume specification: %s", 337 HTTPStatusCode: http.StatusInternalServerError, 338 }) 339 340 // ErrorCodeVolumeAbs is generated when path to a volume isn't absolute. 341 ErrorCodeVolumeAbs = errcode.Register(errGroup, errcode.ErrorDescriptor{ 342 Value: "VOLUMEABS", 343 Message: "Invalid volume destination path: %s mount path must be absolute.", 344 HTTPStatusCode: http.StatusInternalServerError, 345 }) 346 347 // ErrorCodeVolumeFromBlank is generated when path to a volume is blank. 348 ErrorCodeVolumeFromBlank = errcode.Register(errGroup, errcode.ErrorDescriptor{ 349 Value: "VOLUMEFROMBLANK", 350 Message: "malformed volumes-from specification: %s", 351 HTTPStatusCode: http.StatusInternalServerError, 352 }) 353 354 // ErrorCodeVolumeMode is generated when 'mode' for a volume 355 // isn't a valid. 356 ErrorCodeVolumeMode = errcode.Register(errGroup, errcode.ErrorDescriptor{ 357 Value: "VOLUMEMODE", 358 Message: "invalid mode for volumes-from: %s", 359 HTTPStatusCode: http.StatusInternalServerError, 360 }) 361 362 // ErrorCodeVolumeDup is generated when we try to mount two volumes 363 // to the same path. 364 ErrorCodeVolumeDup = errcode.Register(errGroup, errcode.ErrorDescriptor{ 365 Value: "VOLUMEDUP", 366 Message: "Duplicate bind mount %s", 367 HTTPStatusCode: http.StatusInternalServerError, 368 }) 369 370 // ErrorCodeCantUnpause is generated when there's an error while trying 371 // to unpause a container. 372 ErrorCodeCantUnpause = errcode.Register(errGroup, errcode.ErrorDescriptor{ 373 Value: "CANTUNPAUSE", 374 Message: "Cannot unpause container %s: %s", 375 HTTPStatusCode: http.StatusInternalServerError, 376 }) 377 378 // ErrorCodePSError is generated when trying to run 'ps'. 379 ErrorCodePSError = errcode.Register(errGroup, errcode.ErrorDescriptor{ 380 Value: "PSError", 381 Message: "Error running ps: %s", 382 HTTPStatusCode: http.StatusInternalServerError, 383 }) 384 385 // ErrorCodeNoPID is generated when looking for the PID field in the 386 // ps output. 387 ErrorCodeNoPID = errcode.Register(errGroup, errcode.ErrorDescriptor{ 388 Value: "NOPID", 389 Message: "Couldn't find PID field in ps output", 390 HTTPStatusCode: http.StatusInternalServerError, 391 }) 392 393 // ErrorCodeBadPID is generated when we can't convert a PID to an int. 394 ErrorCodeBadPID = errcode.Register(errGroup, errcode.ErrorDescriptor{ 395 Value: "BADPID", 396 Message: "Unexpected pid '%s': %s", 397 HTTPStatusCode: http.StatusInternalServerError, 398 }) 399 400 // ErrorCodeNoTop is generated when we try to run 'top' but can't 401 // because we're on windows. 402 ErrorCodeNoTop = errcode.Register(errGroup, errcode.ErrorDescriptor{ 403 Value: "NOTOP", 404 Message: "Top is not supported on Windows", 405 HTTPStatusCode: http.StatusInternalServerError, 406 }) 407 408 // ErrorCodeStopped is generated when we try to stop a container 409 // that is already stopped. 410 ErrorCodeStopped = errcode.Register(errGroup, errcode.ErrorDescriptor{ 411 Value: "STOPPED", 412 Message: "Container already stopped", 413 HTTPStatusCode: http.StatusNotModified, 414 }) 415 416 // ErrorCodeCantStop is generated when we try to stop a container 417 // but failed for some reason. 418 ErrorCodeCantStop = errcode.Register(errGroup, errcode.ErrorDescriptor{ 419 Value: "CANTSTOP", 420 Message: "Cannot stop container %s: %s\n", 421 HTTPStatusCode: http.StatusInternalServerError, 422 }) 423 424 // ErrorCodeBadCPUFields is generated the number of CPU fields is 425 // less than 8. 426 ErrorCodeBadCPUFields = errcode.Register(errGroup, errcode.ErrorDescriptor{ 427 Value: "BADCPUFIELDS", 428 Message: "invalid number of cpu fields", 429 HTTPStatusCode: http.StatusInternalServerError, 430 }) 431 432 // ErrorCodeBadCPUInt is generated the CPU field can't be parsed as an int. 433 ErrorCodeBadCPUInt = errcode.Register(errGroup, errcode.ErrorDescriptor{ 434 Value: "BADCPUINT", 435 Message: "Unable to convert value %s to int: %s", 436 HTTPStatusCode: http.StatusInternalServerError, 437 }) 438 439 // ErrorCodeBadStatFormat is generated the output of the stat info 440 // isn't parseable. 441 ErrorCodeBadStatFormat = errcode.Register(errGroup, errcode.ErrorDescriptor{ 442 Value: "BADSTATFORMAT", 443 Message: "invalid stat format", 444 HTTPStatusCode: http.StatusInternalServerError, 445 }) 446 447 // ErrorCodeTimedOut is generated when a timer expires. 448 ErrorCodeTimedOut = errcode.Register(errGroup, errcode.ErrorDescriptor{ 449 Value: "TIMEDOUT", 450 Message: "Timed out: %v", 451 HTTPStatusCode: http.StatusInternalServerError, 452 }) 453 454 // ErrorCodeAlreadyRemoving is generated when we try to remove a 455 // container that is already being removed. 456 ErrorCodeAlreadyRemoving = errcode.Register(errGroup, errcode.ErrorDescriptor{ 457 Value: "ALREADYREMOVING", 458 Message: "Status is already RemovalInProgress", 459 HTTPStatusCode: http.StatusInternalServerError, 460 }) 461 462 // ErrorCodeStartPaused is generated when we start a paused container. 463 ErrorCodeStartPaused = errcode.Register(errGroup, errcode.ErrorDescriptor{ 464 Value: "STARTPAUSED", 465 Message: "Cannot start a paused container, try unpause instead.", 466 HTTPStatusCode: http.StatusInternalServerError, 467 }) 468 469 // ErrorCodeAlreadyStarted is generated when we try to start a container 470 // that is already running. 471 ErrorCodeAlreadyStarted = errcode.Register(errGroup, errcode.ErrorDescriptor{ 472 Value: "ALREADYSTARTED", 473 Message: "Container already started", 474 HTTPStatusCode: http.StatusNotModified, 475 }) 476 477 // ErrorCodeHostConfigStart is generated when a HostConfig is passed 478 // into the start command. 479 ErrorCodeHostConfigStart = errcode.Register(errGroup, errcode.ErrorDescriptor{ 480 Value: "HOSTCONFIGSTART", 481 Message: "Supplying a hostconfig on start is not supported. It should be supplied on create", 482 HTTPStatusCode: http.StatusInternalServerError, 483 }) 484 485 // ErrorCodeCantStart is generated when an error occurred while 486 // trying to start a container. 487 ErrorCodeCantStart = errcode.Register(errGroup, errcode.ErrorDescriptor{ 488 Value: "CANTSTART", 489 Message: "Cannot start container %s: %s", 490 HTTPStatusCode: http.StatusInternalServerError, 491 }) 492 )