Per @calavera's suggestion: https://github.com/docker/docker/pull/16355#issuecomment-141139220
Signed-off-by: Doug Davis <dug@us.ibm.com>
| 1 | 1 |
deleted file mode 100644 |
| ... | ... |
@@ -1,58 +0,0 @@ |
| 1 |
-Docker 'errors' package |
|
| 2 |
-======================= |
|
| 3 |
- |
|
| 4 |
-This package contains all of the error messages generated by the Docker |
|
| 5 |
-engine that might be exposed via the Docker engine's REST API. |
|
| 6 |
- |
|
| 7 |
-Each top-level engine package will have its own file in this directory |
|
| 8 |
-so that there's a clear grouping of errors, instead of just one big |
|
| 9 |
-file. The errors for each package are defined here instead of within |
|
| 10 |
-their respective package structure so that Docker CLI code that may need |
|
| 11 |
-to import these error definition files will not need to know or understand |
|
| 12 |
-the engine's package/directory structure. In other words, all they should |
|
| 13 |
-need to do is import `.../docker/api/errors` and they will automatically |
|
| 14 |
-pick up all Docker engine defined errors. This also gives the engine |
|
| 15 |
-developers the freedom to change the engine packaging structure (e.g. to |
|
| 16 |
-CRUD packages) without worrying about breaking existing clients. |
|
| 17 |
- |
|
| 18 |
-These errors are defined using the 'errcode' package. The `errcode` package |
|
| 19 |
-allows for each error to be typed and include all information necessary to |
|
| 20 |
-have further processing done on them if necessary. In particular, each error |
|
| 21 |
-includes: |
|
| 22 |
- |
|
| 23 |
-* Value - a unique string (in all caps) associated with this error. |
|
| 24 |
-Typically, this string is the same name as the variable name of the error |
|
| 25 |
-(w/o the `ErrorCode` text) but in all caps. |
|
| 26 |
- |
|
| 27 |
-* Message - the human readable sentence that will be displayed for this |
|
| 28 |
-error. It can contain '%s' substitutions that allows for the code generating |
|
| 29 |
-the error to specify values that will be inserted in the string prior to |
|
| 30 |
-being displayed to the end-user. The `WithArgs()` function can be used to |
|
| 31 |
-specify the insertion strings. Note, the evaluation of the strings will be |
|
| 32 |
-done at the time `WithArgs()` is called. |
|
| 33 |
- |
|
| 34 |
-* Description - additional human readable text to further explain the |
|
| 35 |
-circumstances of the error situation. |
|
| 36 |
- |
|
| 37 |
-* HTTPStatusCode - when the error is returned back to a CLI, this value |
|
| 38 |
-will be used to populate the HTTP status code. If not present the default |
|
| 39 |
-value will be `StatusInternalServerError`, 500. |
|
| 40 |
- |
|
| 41 |
-Not all errors generated within the engine's executable will be propagated |
|
| 42 |
-back to the engine's API layer. For example, it is expected that errors |
|
| 43 |
-generated by vendored code (under `docker/vendor`) and packaged code |
|
| 44 |
-(under `docker/pkg`) will be converted into errors defined by this package. |
|
| 45 |
- |
|
| 46 |
-When processing an errcode error, if you are looking for a particular |
|
| 47 |
-error then you can do something like: |
|
| 48 |
- |
|
| 49 |
-``` |
|
| 50 |
-import derr "github.com/docker/docker/api/errors" |
|
| 51 |
- |
|
| 52 |
-... |
|
| 53 |
- |
|
| 54 |
-err := someFunc() |
|
| 55 |
-if err.ErrorCode() == derr.ErrorCodeNoSuchContainer {
|
|
| 56 |
- ... |
|
| 57 |
-} |
|
| 58 |
-``` |
| 59 | 1 |
deleted file mode 100644 |
| ... | ... |
@@ -1,93 +0,0 @@ |
| 1 |
-package errors |
|
| 2 |
- |
|
| 3 |
-// This file contains all of the errors that can be generated from the |
|
| 4 |
-// docker/builder component. |
|
| 5 |
- |
|
| 6 |
-import ( |
|
| 7 |
- "net/http" |
|
| 8 |
- |
|
| 9 |
- "github.com/docker/distribution/registry/api/errcode" |
|
| 10 |
-) |
|
| 11 |
- |
|
| 12 |
-var ( |
|
| 13 |
- // ErrorCodeAtLeastOneArg is generated when the parser comes across a |
|
| 14 |
- // Dockerfile command that doesn't have any args. |
|
| 15 |
- ErrorCodeAtLeastOneArg = errcode.Register(errGroup, errcode.ErrorDescriptor{
|
|
| 16 |
- Value: "ATLEASTONEARG", |
|
| 17 |
- Message: "%s requires at least one argument", |
|
| 18 |
- Description: "The specified command requires at least one argument", |
|
| 19 |
- HTTPStatusCode: http.StatusInternalServerError, |
|
| 20 |
- }) |
|
| 21 |
- |
|
| 22 |
- // ErrorCodeExactlyOneArg is generated when the parser comes across a |
|
| 23 |
- // Dockerfile command that requires exactly one arg but got less/more. |
|
| 24 |
- ErrorCodeExactlyOneArg = errcode.Register(errGroup, errcode.ErrorDescriptor{
|
|
| 25 |
- Value: "EXACTLYONEARG", |
|
| 26 |
- Message: "%s requires exactly one argument", |
|
| 27 |
- Description: "The specified command requires exactly one argument", |
|
| 28 |
- HTTPStatusCode: http.StatusInternalServerError, |
|
| 29 |
- }) |
|
| 30 |
- |
|
| 31 |
- // ErrorCodeAtLeastTwoArgs is generated when the parser comes across a |
|
| 32 |
- // Dockerfile command that requires at least two args but got less. |
|
| 33 |
- ErrorCodeAtLeastTwoArgs = errcode.Register(errGroup, errcode.ErrorDescriptor{
|
|
| 34 |
- Value: "ATLEASTTWOARGS", |
|
| 35 |
- Message: "%s requires at least two arguments", |
|
| 36 |
- Description: "The specified command requires at least two arguments", |
|
| 37 |
- HTTPStatusCode: http.StatusInternalServerError, |
|
| 38 |
- }) |
|
| 39 |
- |
|
| 40 |
- // ErrorCodeTooManyArgs is generated when the parser comes across a |
|
| 41 |
- // Dockerfile command that has more args than it should |
|
| 42 |
- ErrorCodeTooManyArgs = errcode.Register(errGroup, errcode.ErrorDescriptor{
|
|
| 43 |
- Value: "TOOMANYARGS", |
|
| 44 |
- Message: "Bad input to %s, too many args", |
|
| 45 |
- Description: "The specified command was passed too many arguments", |
|
| 46 |
- HTTPStatusCode: http.StatusInternalServerError, |
|
| 47 |
- }) |
|
| 48 |
- |
|
| 49 |
- // ErrorCodeChainOnBuild is generated when the parser comes across a |
|
| 50 |
- // Dockerfile command that is trying to chain ONBUILD commands. |
|
| 51 |
- ErrorCodeChainOnBuild = errcode.Register(errGroup, errcode.ErrorDescriptor{
|
|
| 52 |
- Value: "CHAINONBUILD", |
|
| 53 |
- Message: "Chaining ONBUILD via `ONBUILD ONBUILD` isn't allowed", |
|
| 54 |
- Description: "ONBUILD Dockerfile commands aren't allow on ONBUILD commands", |
|
| 55 |
- HTTPStatusCode: http.StatusInternalServerError, |
|
| 56 |
- }) |
|
| 57 |
- |
|
| 58 |
- // ErrorCodeBadOnBuildCmd is generated when the parser comes across a |
|
| 59 |
- // an ONBUILD Dockerfile command with an invalid trigger/command. |
|
| 60 |
- ErrorCodeBadOnBuildCmd = errcode.Register(errGroup, errcode.ErrorDescriptor{
|
|
| 61 |
- Value: "BADONBUILDCMD", |
|
| 62 |
- Message: "%s isn't allowed as an ONBUILD trigger", |
|
| 63 |
- Description: "The specified ONBUILD command isn't allowed", |
|
| 64 |
- HTTPStatusCode: http.StatusInternalServerError, |
|
| 65 |
- }) |
|
| 66 |
- |
|
| 67 |
- // ErrorCodeMissingFrom is generated when the Dockerfile is missing |
|
| 68 |
- // a FROM command. |
|
| 69 |
- ErrorCodeMissingFrom = errcode.Register(errGroup, errcode.ErrorDescriptor{
|
|
| 70 |
- Value: "MISSINGFROM", |
|
| 71 |
- Message: "Please provide a source image with `from` prior to run", |
|
| 72 |
- Description: "The Dockerfile is missing a FROM command", |
|
| 73 |
- HTTPStatusCode: http.StatusInternalServerError, |
|
| 74 |
- }) |
|
| 75 |
- |
|
| 76 |
- // ErrorCodeNotOnWindows is generated when the specified Dockerfile |
|
| 77 |
- // command is not supported on Windows. |
|
| 78 |
- ErrorCodeNotOnWindows = errcode.Register(errGroup, errcode.ErrorDescriptor{
|
|
| 79 |
- Value: "NOTONWINDOWS", |
|
| 80 |
- Message: "%s is not supported on Windows", |
|
| 81 |
- Description: "The specified Dockerfile command is not supported on Windows", |
|
| 82 |
- HTTPStatusCode: http.StatusInternalServerError, |
|
| 83 |
- }) |
|
| 84 |
- |
|
| 85 |
- // ErrorCodeVolumeEmpty is generated when the specified Volume string |
|
| 86 |
- // is empty. |
|
| 87 |
- ErrorCodeVolumeEmpty = errcode.Register(errGroup, errcode.ErrorDescriptor{
|
|
| 88 |
- Value: "VOLUMEEMPTY", |
|
| 89 |
- Message: "Volume specified can not be an empty string", |
|
| 90 |
- Description: "The specified volume can not be an empty string", |
|
| 91 |
- HTTPStatusCode: http.StatusInternalServerError, |
|
| 92 |
- }) |
|
| 93 |
-) |
| 94 | 1 |
deleted file mode 100644 |
| ... | ... |
@@ -1,492 +0,0 @@ |
| 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 |
-) |
| ... | ... |
@@ -13,10 +13,10 @@ import ( |
| 13 | 13 |
|
| 14 | 14 |
"github.com/Sirupsen/logrus" |
| 15 | 15 |
"github.com/docker/distribution/registry/api/errcode" |
| 16 |
- derr "github.com/docker/docker/api/errors" |
|
| 17 | 16 |
"github.com/docker/docker/api/types" |
| 18 | 17 |
"github.com/docker/docker/context" |
| 19 | 18 |
"github.com/docker/docker/daemon" |
| 19 |
+ derr "github.com/docker/docker/errors" |
|
| 20 | 20 |
"github.com/docker/docker/pkg/ioutils" |
| 21 | 21 |
"github.com/docker/docker/pkg/signal" |
| 22 | 22 |
"github.com/docker/docker/pkg/version" |
| ... | ... |
@@ -218,7 +218,7 @@ func httpError(w http.ResponseWriter, err error) {
|
| 218 | 218 |
case errcode.Error: |
| 219 | 219 |
// For reference, if you're looking for a particular error |
| 220 | 220 |
// then you can do something like : |
| 221 |
- // import ( derr "github.com/docker/docker/api/errors" ) |
|
| 221 |
+ // import ( derr "github.com/docker/docker/errors" ) |
|
| 222 | 222 |
// if daError.ErrorCode() == derr.ErrorCodeNoSuchContainer { ... }
|
| 223 | 223 |
|
| 224 | 224 |
daError, _ := err.(errcode.Error) |
| ... | ... |
@@ -18,7 +18,7 @@ import ( |
| 18 | 18 |
"strings" |
| 19 | 19 |
|
| 20 | 20 |
"github.com/Sirupsen/logrus" |
| 21 |
- derr "github.com/docker/docker/api/errors" |
|
| 21 |
+ derr "github.com/docker/docker/errors" |
|
| 22 | 22 |
flag "github.com/docker/docker/pkg/mflag" |
| 23 | 23 |
"github.com/docker/docker/pkg/nat" |
| 24 | 24 |
"github.com/docker/docker/pkg/signal" |
| ... | ... |
@@ -15,11 +15,11 @@ import ( |
| 15 | 15 |
"github.com/opencontainers/runc/libcontainer/label" |
| 16 | 16 |
|
| 17 | 17 |
"github.com/Sirupsen/logrus" |
| 18 |
- derr "github.com/docker/docker/api/errors" |
|
| 19 | 18 |
"github.com/docker/docker/daemon/execdriver" |
| 20 | 19 |
"github.com/docker/docker/daemon/logger" |
| 21 | 20 |
"github.com/docker/docker/daemon/logger/jsonfilelog" |
| 22 | 21 |
"github.com/docker/docker/daemon/network" |
| 22 |
+ derr "github.com/docker/docker/errors" |
|
| 23 | 23 |
"github.com/docker/docker/image" |
| 24 | 24 |
"github.com/docker/docker/pkg/archive" |
| 25 | 25 |
"github.com/docker/docker/pkg/broadcastwriter" |
| ... | ... |
@@ -15,10 +15,10 @@ import ( |
| 15 | 15 |
"time" |
| 16 | 16 |
|
| 17 | 17 |
"github.com/Sirupsen/logrus" |
| 18 |
- derr "github.com/docker/docker/api/errors" |
|
| 19 | 18 |
"github.com/docker/docker/daemon/execdriver" |
| 20 | 19 |
"github.com/docker/docker/daemon/links" |
| 21 | 20 |
"github.com/docker/docker/daemon/network" |
| 21 |
+ derr "github.com/docker/docker/errors" |
|
| 22 | 22 |
"github.com/docker/docker/pkg/directory" |
| 23 | 23 |
"github.com/docker/docker/pkg/nat" |
| 24 | 24 |
"github.com/docker/docker/pkg/stringid" |
| ... | ... |
@@ -5,8 +5,8 @@ package daemon |
| 5 | 5 |
import ( |
| 6 | 6 |
"strings" |
| 7 | 7 |
|
| 8 |
- derr "github.com/docker/docker/api/errors" |
|
| 9 | 8 |
"github.com/docker/docker/daemon/execdriver" |
| 9 |
+ derr "github.com/docker/docker/errors" |
|
| 10 | 10 |
) |
| 11 | 11 |
|
| 12 | 12 |
// DefaultPathEnv is deliberately empty on Windows as the default path will be set by |
| ... | ... |
@@ -4,8 +4,8 @@ import ( |
| 4 | 4 |
"strings" |
| 5 | 5 |
|
| 6 | 6 |
"github.com/Sirupsen/logrus" |
| 7 |
- derr "github.com/docker/docker/api/errors" |
|
| 8 | 7 |
"github.com/docker/docker/api/types" |
| 8 |
+ derr "github.com/docker/docker/errors" |
|
| 9 | 9 |
"github.com/docker/docker/graph/tags" |
| 10 | 10 |
"github.com/docker/docker/image" |
| 11 | 11 |
"github.com/docker/docker/pkg/parsers" |
| ... | ... |
@@ -20,11 +20,11 @@ import ( |
| 20 | 20 |
|
| 21 | 21 |
"github.com/Sirupsen/logrus" |
| 22 | 22 |
"github.com/docker/docker/api" |
| 23 |
- derr "github.com/docker/docker/api/errors" |
|
| 24 | 23 |
"github.com/docker/docker/daemon/events" |
| 25 | 24 |
"github.com/docker/docker/daemon/execdriver" |
| 26 | 25 |
"github.com/docker/docker/daemon/execdriver/execdrivers" |
| 27 | 26 |
"github.com/docker/docker/daemon/graphdriver" |
| 27 |
+ derr "github.com/docker/docker/errors" |
|
| 28 | 28 |
// register vfs |
| 29 | 29 |
_ "github.com/docker/docker/daemon/graphdriver/vfs" |
| 30 | 30 |
"github.com/docker/docker/daemon/logger" |
| ... | ... |
@@ -11,8 +11,8 @@ import ( |
| 11 | 11 |
"time" |
| 12 | 12 |
|
| 13 | 13 |
"github.com/Sirupsen/logrus" |
| 14 |
- derr "github.com/docker/docker/api/errors" |
|
| 15 | 14 |
"github.com/docker/docker/daemon/execdriver" |
| 15 |
+ derr "github.com/docker/docker/errors" |
|
| 16 | 16 |
"github.com/docker/docker/pkg/pubsub" |
| 17 | 17 |
"github.com/opencontainers/runc/libcontainer/system" |
| 18 | 18 |
) |
| ... | ... |
@@ -10,8 +10,8 @@ import ( |
| 10 | 10 |
"sync" |
| 11 | 11 |
|
| 12 | 12 |
"github.com/Sirupsen/logrus" |
| 13 |
- derr "github.com/docker/docker/api/errors" |
|
| 14 | 13 |
"github.com/docker/docker/api/types" |
| 14 |
+ derr "github.com/docker/docker/errors" |
|
| 15 | 15 |
"github.com/docker/docker/pkg/chrootarchive" |
| 16 | 16 |
"github.com/docker/docker/pkg/system" |
| 17 | 17 |
"github.com/docker/docker/volume" |
| ... | ... |
@@ -10,8 +10,8 @@ import ( |
| 10 | 10 |
"strings" |
| 11 | 11 |
|
| 12 | 12 |
"github.com/Sirupsen/logrus" |
| 13 |
- derr "github.com/docker/docker/api/errors" |
|
| 14 | 13 |
"github.com/docker/docker/daemon/execdriver" |
| 14 |
+ derr "github.com/docker/docker/errors" |
|
| 15 | 15 |
"github.com/docker/docker/pkg/system" |
| 16 | 16 |
"github.com/docker/docker/runconfig" |
| 17 | 17 |
"github.com/docker/docker/volume" |
| 18 | 18 |
new file mode 100644 |
| ... | ... |
@@ -0,0 +1,58 @@ |
| 0 |
+Docker 'errors' package |
|
| 1 |
+======================= |
|
| 2 |
+ |
|
| 3 |
+This package contains all of the error messages generated by the Docker |
|
| 4 |
+engine that might be exposed via the Docker engine's REST API. |
|
| 5 |
+ |
|
| 6 |
+Each top-level engine package will have its own file in this directory |
|
| 7 |
+so that there's a clear grouping of errors, instead of just one big |
|
| 8 |
+file. The errors for each package are defined here instead of within |
|
| 9 |
+their respective package structure so that Docker CLI code that may need |
|
| 10 |
+to import these error definition files will not need to know or understand |
|
| 11 |
+the engine's package/directory structure. In other words, all they should |
|
| 12 |
+need to do is import `.../docker/errors` and they will automatically |
|
| 13 |
+pick up all Docker engine defined errors. This also gives the engine |
|
| 14 |
+developers the freedom to change the engine packaging structure (e.g. to |
|
| 15 |
+CRUD packages) without worrying about breaking existing clients. |
|
| 16 |
+ |
|
| 17 |
+These errors are defined using the 'errcode' package. The `errcode` package |
|
| 18 |
+allows for each error to be typed and include all information necessary to |
|
| 19 |
+have further processing done on them if necessary. In particular, each error |
|
| 20 |
+includes: |
|
| 21 |
+ |
|
| 22 |
+* Value - a unique string (in all caps) associated with this error. |
|
| 23 |
+Typically, this string is the same name as the variable name of the error |
|
| 24 |
+(w/o the `ErrorCode` text) but in all caps. |
|
| 25 |
+ |
|
| 26 |
+* Message - the human readable sentence that will be displayed for this |
|
| 27 |
+error. It can contain '%s' substitutions that allows for the code generating |
|
| 28 |
+the error to specify values that will be inserted in the string prior to |
|
| 29 |
+being displayed to the end-user. The `WithArgs()` function can be used to |
|
| 30 |
+specify the insertion strings. Note, the evaluation of the strings will be |
|
| 31 |
+done at the time `WithArgs()` is called. |
|
| 32 |
+ |
|
| 33 |
+* Description - additional human readable text to further explain the |
|
| 34 |
+circumstances of the error situation. |
|
| 35 |
+ |
|
| 36 |
+* HTTPStatusCode - when the error is returned back to a CLI, this value |
|
| 37 |
+will be used to populate the HTTP status code. If not present the default |
|
| 38 |
+value will be `StatusInternalServerError`, 500. |
|
| 39 |
+ |
|
| 40 |
+Not all errors generated within the engine's executable will be propagated |
|
| 41 |
+back to the engine's API layer. For example, it is expected that errors |
|
| 42 |
+generated by vendored code (under `docker/vendor`) and packaged code |
|
| 43 |
+(under `docker/pkg`) will be converted into errors defined by this package. |
|
| 44 |
+ |
|
| 45 |
+When processing an errcode error, if you are looking for a particular |
|
| 46 |
+error then you can do something like: |
|
| 47 |
+ |
|
| 48 |
+``` |
|
| 49 |
+import derr "github.com/docker/docker/errors" |
|
| 50 |
+ |
|
| 51 |
+... |
|
| 52 |
+ |
|
| 53 |
+err := someFunc() |
|
| 54 |
+if err.ErrorCode() == derr.ErrorCodeNoSuchContainer {
|
|
| 55 |
+ ... |
|
| 56 |
+} |
|
| 57 |
+``` |
| 0 | 58 |
new file mode 100644 |
| ... | ... |
@@ -0,0 +1,93 @@ |
| 0 |
+package errors |
|
| 1 |
+ |
|
| 2 |
+// This file contains all of the errors that can be generated from the |
|
| 3 |
+// docker/builder component. |
|
| 4 |
+ |
|
| 5 |
+import ( |
|
| 6 |
+ "net/http" |
|
| 7 |
+ |
|
| 8 |
+ "github.com/docker/distribution/registry/api/errcode" |
|
| 9 |
+) |
|
| 10 |
+ |
|
| 11 |
+var ( |
|
| 12 |
+ // ErrorCodeAtLeastOneArg is generated when the parser comes across a |
|
| 13 |
+ // Dockerfile command that doesn't have any args. |
|
| 14 |
+ ErrorCodeAtLeastOneArg = errcode.Register(errGroup, errcode.ErrorDescriptor{
|
|
| 15 |
+ Value: "ATLEASTONEARG", |
|
| 16 |
+ Message: "%s requires at least one argument", |
|
| 17 |
+ Description: "The specified command requires at least one argument", |
|
| 18 |
+ HTTPStatusCode: http.StatusInternalServerError, |
|
| 19 |
+ }) |
|
| 20 |
+ |
|
| 21 |
+ // ErrorCodeExactlyOneArg is generated when the parser comes across a |
|
| 22 |
+ // Dockerfile command that requires exactly one arg but got less/more. |
|
| 23 |
+ ErrorCodeExactlyOneArg = errcode.Register(errGroup, errcode.ErrorDescriptor{
|
|
| 24 |
+ Value: "EXACTLYONEARG", |
|
| 25 |
+ Message: "%s requires exactly one argument", |
|
| 26 |
+ Description: "The specified command requires exactly one argument", |
|
| 27 |
+ HTTPStatusCode: http.StatusInternalServerError, |
|
| 28 |
+ }) |
|
| 29 |
+ |
|
| 30 |
+ // ErrorCodeAtLeastTwoArgs is generated when the parser comes across a |
|
| 31 |
+ // Dockerfile command that requires at least two args but got less. |
|
| 32 |
+ ErrorCodeAtLeastTwoArgs = errcode.Register(errGroup, errcode.ErrorDescriptor{
|
|
| 33 |
+ Value: "ATLEASTTWOARGS", |
|
| 34 |
+ Message: "%s requires at least two arguments", |
|
| 35 |
+ Description: "The specified command requires at least two arguments", |
|
| 36 |
+ HTTPStatusCode: http.StatusInternalServerError, |
|
| 37 |
+ }) |
|
| 38 |
+ |
|
| 39 |
+ // ErrorCodeTooManyArgs is generated when the parser comes across a |
|
| 40 |
+ // Dockerfile command that has more args than it should |
|
| 41 |
+ ErrorCodeTooManyArgs = errcode.Register(errGroup, errcode.ErrorDescriptor{
|
|
| 42 |
+ Value: "TOOMANYARGS", |
|
| 43 |
+ Message: "Bad input to %s, too many args", |
|
| 44 |
+ Description: "The specified command was passed too many arguments", |
|
| 45 |
+ HTTPStatusCode: http.StatusInternalServerError, |
|
| 46 |
+ }) |
|
| 47 |
+ |
|
| 48 |
+ // ErrorCodeChainOnBuild is generated when the parser comes across a |
|
| 49 |
+ // Dockerfile command that is trying to chain ONBUILD commands. |
|
| 50 |
+ ErrorCodeChainOnBuild = errcode.Register(errGroup, errcode.ErrorDescriptor{
|
|
| 51 |
+ Value: "CHAINONBUILD", |
|
| 52 |
+ Message: "Chaining ONBUILD via `ONBUILD ONBUILD` isn't allowed", |
|
| 53 |
+ Description: "ONBUILD Dockerfile commands aren't allow on ONBUILD commands", |
|
| 54 |
+ HTTPStatusCode: http.StatusInternalServerError, |
|
| 55 |
+ }) |
|
| 56 |
+ |
|
| 57 |
+ // ErrorCodeBadOnBuildCmd is generated when the parser comes across a |
|
| 58 |
+ // an ONBUILD Dockerfile command with an invalid trigger/command. |
|
| 59 |
+ ErrorCodeBadOnBuildCmd = errcode.Register(errGroup, errcode.ErrorDescriptor{
|
|
| 60 |
+ Value: "BADONBUILDCMD", |
|
| 61 |
+ Message: "%s isn't allowed as an ONBUILD trigger", |
|
| 62 |
+ Description: "The specified ONBUILD command isn't allowed", |
|
| 63 |
+ HTTPStatusCode: http.StatusInternalServerError, |
|
| 64 |
+ }) |
|
| 65 |
+ |
|
| 66 |
+ // ErrorCodeMissingFrom is generated when the Dockerfile is missing |
|
| 67 |
+ // a FROM command. |
|
| 68 |
+ ErrorCodeMissingFrom = errcode.Register(errGroup, errcode.ErrorDescriptor{
|
|
| 69 |
+ Value: "MISSINGFROM", |
|
| 70 |
+ Message: "Please provide a source image with `from` prior to run", |
|
| 71 |
+ Description: "The Dockerfile is missing a FROM command", |
|
| 72 |
+ HTTPStatusCode: http.StatusInternalServerError, |
|
| 73 |
+ }) |
|
| 74 |
+ |
|
| 75 |
+ // ErrorCodeNotOnWindows is generated when the specified Dockerfile |
|
| 76 |
+ // command is not supported on Windows. |
|
| 77 |
+ ErrorCodeNotOnWindows = errcode.Register(errGroup, errcode.ErrorDescriptor{
|
|
| 78 |
+ Value: "NOTONWINDOWS", |
|
| 79 |
+ Message: "%s is not supported on Windows", |
|
| 80 |
+ Description: "The specified Dockerfile command is not supported on Windows", |
|
| 81 |
+ HTTPStatusCode: http.StatusInternalServerError, |
|
| 82 |
+ }) |
|
| 83 |
+ |
|
| 84 |
+ // ErrorCodeVolumeEmpty is generated when the specified Volume string |
|
| 85 |
+ // is empty. |
|
| 86 |
+ ErrorCodeVolumeEmpty = errcode.Register(errGroup, errcode.ErrorDescriptor{
|
|
| 87 |
+ Value: "VOLUMEEMPTY", |
|
| 88 |
+ Message: "Volume specified can not be an empty string", |
|
| 89 |
+ Description: "The specified volume can not be an empty string", |
|
| 90 |
+ HTTPStatusCode: http.StatusInternalServerError, |
|
| 91 |
+ }) |
|
| 92 |
+) |
| 0 | 93 |
new file mode 100644 |
| ... | ... |
@@ -0,0 +1,492 @@ |
| 0 |
+package errors |
|
| 1 |
+ |
|
| 2 |
+// This file contains all of the errors that can be generated from the |
|
| 3 |
+// docker/daemon component. |
|
| 4 |
+ |
|
| 5 |
+import ( |
|
| 6 |
+ "net/http" |
|
| 7 |
+ |
|
| 8 |
+ "github.com/docker/distribution/registry/api/errcode" |
|
| 9 |
+) |
|
| 10 |
+ |
|
| 11 |
+var ( |
|
| 12 |
+ // ErrorCodeNoSuchContainer is generated when we look for a container by |
|
| 13 |
+ // name or ID and we can't find it. |
|
| 14 |
+ ErrorCodeNoSuchContainer = errcode.Register(errGroup, errcode.ErrorDescriptor{
|
|
| 15 |
+ Value: "NOSUCHCONTAINER", |
|
| 16 |
+ Message: "no such id: %s", |
|
| 17 |
+ Description: "The specified container can not be found", |
|
| 18 |
+ HTTPStatusCode: http.StatusNotFound, |
|
| 19 |
+ }) |
|
| 20 |
+ |
|
| 21 |
+ // ErrorCodeUnregisteredContainer is generated when we try to load |
|
| 22 |
+ // a storage driver for an unregistered container |
|
| 23 |
+ ErrorCodeUnregisteredContainer = errcode.Register(errGroup, errcode.ErrorDescriptor{
|
|
| 24 |
+ Value: "UNREGISTEREDCONTAINER", |
|
| 25 |
+ Message: "Can't load storage driver for unregistered container %s", |
|
| 26 |
+ HTTPStatusCode: http.StatusInternalServerError, |
|
| 27 |
+ }) |
|
| 28 |
+ |
|
| 29 |
+ // ErrorCodeContainerBeingRemoved is generated when an attempt to start |
|
| 30 |
+ // a container is made but its in the process of being removed, or is dead. |
|
| 31 |
+ ErrorCodeContainerBeingRemoved = errcode.Register(errGroup, errcode.ErrorDescriptor{
|
|
| 32 |
+ Value: "CONTAINERBEINGREMOVED", |
|
| 33 |
+ Message: "Container is marked for removal and cannot be started.", |
|
| 34 |
+ HTTPStatusCode: http.StatusInternalServerError, |
|
| 35 |
+ }) |
|
| 36 |
+ |
|
| 37 |
+ // ErrorCodeUnpauseContainer is generated when we attempt to stop a |
|
| 38 |
+ // container but its paused. |
|
| 39 |
+ ErrorCodeUnpauseContainer = errcode.Register(errGroup, errcode.ErrorDescriptor{
|
|
| 40 |
+ Value: "UNPAUSECONTAINER", |
|
| 41 |
+ Message: "Container %s is paused. Unpause the container before stopping", |
|
| 42 |
+ HTTPStatusCode: http.StatusInternalServerError, |
|
| 43 |
+ }) |
|
| 44 |
+ |
|
| 45 |
+ // ErrorCodeAlreadyPaused is generated when we attempt to pause a |
|
| 46 |
+ // container when its already paused. |
|
| 47 |
+ ErrorCodeAlreadyPaused = errcode.Register(errGroup, errcode.ErrorDescriptor{
|
|
| 48 |
+ Value: "ALREADYPAUSED", |
|
| 49 |
+ Message: "Container %s is already paused", |
|
| 50 |
+ HTTPStatusCode: http.StatusInternalServerError, |
|
| 51 |
+ }) |
|
| 52 |
+ |
|
| 53 |
+ // ErrorCodeNotPaused is generated when we attempt to unpause a |
|
| 54 |
+ // container when its not paused. |
|
| 55 |
+ ErrorCodeNotPaused = errcode.Register(errGroup, errcode.ErrorDescriptor{
|
|
| 56 |
+ Value: "NOTPAUSED", |
|
| 57 |
+ Message: "Container %s is not paused", |
|
| 58 |
+ HTTPStatusCode: http.StatusInternalServerError, |
|
| 59 |
+ }) |
|
| 60 |
+ |
|
| 61 |
+ // ErrorCodeImageUnregContainer is generated when we attempt to get the |
|
| 62 |
+ // image of an unknown/unregistered container. |
|
| 63 |
+ ErrorCodeImageUnregContainer = errcode.Register(errGroup, errcode.ErrorDescriptor{
|
|
| 64 |
+ Value: "IMAGEUNREGCONTAINER", |
|
| 65 |
+ Message: "Can't get image of unregistered container", |
|
| 66 |
+ HTTPStatusCode: http.StatusInternalServerError, |
|
| 67 |
+ }) |
|
| 68 |
+ |
|
| 69 |
+ // ErrorCodeEmptyID is generated when an ID is the emptry string. |
|
| 70 |
+ ErrorCodeEmptyID = errcode.Register(errGroup, errcode.ErrorDescriptor{
|
|
| 71 |
+ Value: "EMPTYID", |
|
| 72 |
+ Message: "Invalid empty id", |
|
| 73 |
+ HTTPStatusCode: http.StatusInternalServerError, |
|
| 74 |
+ }) |
|
| 75 |
+ |
|
| 76 |
+ // ErrorCodeLoggingFactory is generated when we could not load the |
|
| 77 |
+ // log driver. |
|
| 78 |
+ ErrorCodeLoggingFactory = errcode.Register(errGroup, errcode.ErrorDescriptor{
|
|
| 79 |
+ Value: "LOGGINGFACTORY", |
|
| 80 |
+ Message: "Failed to get logging factory: %v", |
|
| 81 |
+ HTTPStatusCode: http.StatusInternalServerError, |
|
| 82 |
+ }) |
|
| 83 |
+ |
|
| 84 |
+ // ErrorCodeInitLogger is generated when we could not initialize |
|
| 85 |
+ // the logging driver. |
|
| 86 |
+ ErrorCodeInitLogger = errcode.Register(errGroup, errcode.ErrorDescriptor{
|
|
| 87 |
+ Value: "INITLOGGER", |
|
| 88 |
+ Message: "Failed to initialize logging driver: %v", |
|
| 89 |
+ HTTPStatusCode: http.StatusInternalServerError, |
|
| 90 |
+ }) |
|
| 91 |
+ |
|
| 92 |
+ // ErrorCodeNotRunning is generated when we need to verify that |
|
| 93 |
+ // a container is running, but its not. |
|
| 94 |
+ ErrorCodeNotRunning = errcode.Register(errGroup, errcode.ErrorDescriptor{
|
|
| 95 |
+ Value: "NOTRUNNING", |
|
| 96 |
+ Message: "Container %s is not running", |
|
| 97 |
+ HTTPStatusCode: http.StatusInternalServerError, |
|
| 98 |
+ }) |
|
| 99 |
+ |
|
| 100 |
+ // ErrorCodeLinkNotRunning is generated when we try to link to a |
|
| 101 |
+ // container that is not running. |
|
| 102 |
+ ErrorCodeLinkNotRunning = errcode.Register(errGroup, errcode.ErrorDescriptor{
|
|
| 103 |
+ Value: "LINKNOTRUNNING", |
|
| 104 |
+ Message: "Cannot link to a non running container: %s AS %s", |
|
| 105 |
+ HTTPStatusCode: http.StatusInternalServerError, |
|
| 106 |
+ }) |
|
| 107 |
+ |
|
| 108 |
+ // ErrorCodeDeviceInfo is generated when there is an error while trying |
|
| 109 |
+ // to get info about a custom device. |
|
| 110 |
+ // container that is not running. |
|
| 111 |
+ ErrorCodeDeviceInfo = errcode.Register(errGroup, errcode.ErrorDescriptor{
|
|
| 112 |
+ Value: "DEVICEINFO", |
|
| 113 |
+ Message: "error gathering device information while adding custom device %q: %s", |
|
| 114 |
+ HTTPStatusCode: http.StatusInternalServerError, |
|
| 115 |
+ }) |
|
| 116 |
+ |
|
| 117 |
+ // ErrorCodeEmptyEndpoint is generated when the endpoint for a port |
|
| 118 |
+ // map is nil. |
|
| 119 |
+ ErrorCodeEmptyEndpoint = errcode.Register(errGroup, errcode.ErrorDescriptor{
|
|
| 120 |
+ Value: "EMPTYENDPOINT", |
|
| 121 |
+ Message: "invalid endpoint while building port map info", |
|
| 122 |
+ HTTPStatusCode: http.StatusInternalServerError, |
|
| 123 |
+ }) |
|
| 124 |
+ |
|
| 125 |
+ // ErrorCodeEmptyNetwork is generated when the networkSettings for a port |
|
| 126 |
+ // map is nil. |
|
| 127 |
+ ErrorCodeEmptyNetwork = errcode.Register(errGroup, errcode.ErrorDescriptor{
|
|
| 128 |
+ Value: "EMPTYNETWORK", |
|
| 129 |
+ Message: "invalid networksettings while building port map info", |
|
| 130 |
+ HTTPStatusCode: http.StatusInternalServerError, |
|
| 131 |
+ }) |
|
| 132 |
+ |
|
| 133 |
+ // ErrorCodeParsingPort is generated when there is an error parsing |
|
| 134 |
+ // a "port" string. |
|
| 135 |
+ ErrorCodeParsingPort = errcode.Register(errGroup, errcode.ErrorDescriptor{
|
|
| 136 |
+ Value: "PARSINGPORT", |
|
| 137 |
+ Message: "Error parsing Port value(%v):%v", |
|
| 138 |
+ HTTPStatusCode: http.StatusInternalServerError, |
|
| 139 |
+ }) |
|
| 140 |
+ |
|
| 141 |
+ // ErrorCodeNoSandbox is generated when we can't find the specified |
|
| 142 |
+ // sandbox(network) by ID. |
|
| 143 |
+ ErrorCodeNoSandbox = errcode.Register(errGroup, errcode.ErrorDescriptor{
|
|
| 144 |
+ Value: "NOSANDBOX", |
|
| 145 |
+ Message: "error locating sandbox id %s: %v", |
|
| 146 |
+ HTTPStatusCode: http.StatusInternalServerError, |
|
| 147 |
+ }) |
|
| 148 |
+ |
|
| 149 |
+ // ErrorCodeNetworkUpdate is generated when there is an error while |
|
| 150 |
+ // trying update a network/sandbox config. |
|
| 151 |
+ ErrorCodeNetworkUpdate = errcode.Register(errGroup, errcode.ErrorDescriptor{
|
|
| 152 |
+ Value: "NETWORKUPDATE", |
|
| 153 |
+ Message: "Update network failed: %v", |
|
| 154 |
+ HTTPStatusCode: http.StatusInternalServerError, |
|
| 155 |
+ }) |
|
| 156 |
+ |
|
| 157 |
+ // ErrorCodeNetworkRefresh is generated when there is an error while |
|
| 158 |
+ // trying refresh a network/sandbox config. |
|
| 159 |
+ ErrorCodeNetworkRefresh = errcode.Register(errGroup, errcode.ErrorDescriptor{
|
|
| 160 |
+ Value: "NETWORKREFRESH", |
|
| 161 |
+ Message: "Update network failed: Failure in refresh sandbox %s: %v", |
|
| 162 |
+ HTTPStatusCode: http.StatusInternalServerError, |
|
| 163 |
+ }) |
|
| 164 |
+ |
|
| 165 |
+ // ErrorCodeHostPort is generated when there was an error while trying |
|
| 166 |
+ // to parse a "host/por" string. |
|
| 167 |
+ ErrorCodeHostPort = errcode.Register(errGroup, errcode.ErrorDescriptor{
|
|
| 168 |
+ Value: "HOSTPORT", |
|
| 169 |
+ Message: "Error parsing HostPort value(%s):%v", |
|
| 170 |
+ HTTPStatusCode: http.StatusInternalServerError, |
|
| 171 |
+ }) |
|
| 172 |
+ |
|
| 173 |
+ // ErrorCodeNetworkConflict is generated when we try to public a service |
|
| 174 |
+ // in network mode. |
|
| 175 |
+ ErrorCodeNetworkConflict = errcode.Register(errGroup, errcode.ErrorDescriptor{
|
|
| 176 |
+ Value: "NETWORKCONFLICT", |
|
| 177 |
+ Message: "conflicting options: publishing a service and network mode", |
|
| 178 |
+ HTTPStatusCode: http.StatusConflict, |
|
| 179 |
+ }) |
|
| 180 |
+ |
|
| 181 |
+ // ErrorCodeJoinInfo is generated when we failed to update a container's |
|
| 182 |
+ // join info. |
|
| 183 |
+ ErrorCodeJoinInfo = errcode.Register(errGroup, errcode.ErrorDescriptor{
|
|
| 184 |
+ Value: "JOININFO", |
|
| 185 |
+ Message: "Updating join info failed: %v", |
|
| 186 |
+ HTTPStatusCode: http.StatusInternalServerError, |
|
| 187 |
+ }) |
|
| 188 |
+ |
|
| 189 |
+ // ErrorCodeIPCRunning is generated when we try to join a container's |
|
| 190 |
+ // IPC but its running. |
|
| 191 |
+ ErrorCodeIPCRunning = errcode.Register(errGroup, errcode.ErrorDescriptor{
|
|
| 192 |
+ Value: "IPCRUNNING", |
|
| 193 |
+ Message: "cannot join IPC of a non running container: %s", |
|
| 194 |
+ HTTPStatusCode: http.StatusInternalServerError, |
|
| 195 |
+ }) |
|
| 196 |
+ |
|
| 197 |
+ // ErrorCodeNotADir is generated when we try to create a directory |
|
| 198 |
+ // but the path isn't a dir. |
|
| 199 |
+ ErrorCodeNotADir = errcode.Register(errGroup, errcode.ErrorDescriptor{
|
|
| 200 |
+ Value: "NOTADIR", |
|
| 201 |
+ Message: "Cannot mkdir: %s is not a directory", |
|
| 202 |
+ HTTPStatusCode: http.StatusInternalServerError, |
|
| 203 |
+ }) |
|
| 204 |
+ |
|
| 205 |
+ // ErrorCodeParseContainer is generated when the reference to a |
|
| 206 |
+ // container doesn't include a ":" (another container). |
|
| 207 |
+ ErrorCodeParseContainer = errcode.Register(errGroup, errcode.ErrorDescriptor{
|
|
| 208 |
+ Value: "PARSECONTAINER", |
|
| 209 |
+ Message: "no container specified to join network", |
|
| 210 |
+ HTTPStatusCode: http.StatusInternalServerError, |
|
| 211 |
+ }) |
|
| 212 |
+ |
|
| 213 |
+ // ErrorCodeJoinSelf is generated when we try to network to ourselves. |
|
| 214 |
+ ErrorCodeJoinSelf = errcode.Register(errGroup, errcode.ErrorDescriptor{
|
|
| 215 |
+ Value: "JOINSELF", |
|
| 216 |
+ Message: "cannot join own network", |
|
| 217 |
+ HTTPStatusCode: http.StatusInternalServerError, |
|
| 218 |
+ }) |
|
| 219 |
+ |
|
| 220 |
+ // ErrorCodeJoinRunning is generated when we try to network to ourselves. |
|
| 221 |
+ ErrorCodeJoinRunning = errcode.Register(errGroup, errcode.ErrorDescriptor{
|
|
| 222 |
+ Value: "JOINRUNNING", |
|
| 223 |
+ Message: "cannot join network of a non running container: %s", |
|
| 224 |
+ HTTPStatusCode: http.StatusInternalServerError, |
|
| 225 |
+ }) |
|
| 226 |
+ |
|
| 227 |
+ // ErrorCodeModeNotContainer is generated when we try to network to |
|
| 228 |
+ // another container but the mode isn't 'container'. |
|
| 229 |
+ ErrorCodeModeNotContainer = errcode.Register(errGroup, errcode.ErrorDescriptor{
|
|
| 230 |
+ Value: "MODENOTCONTAINER", |
|
| 231 |
+ Message: "network mode not set to container", |
|
| 232 |
+ HTTPStatusCode: http.StatusInternalServerError, |
|
| 233 |
+ }) |
|
| 234 |
+ |
|
| 235 |
+ // ErrorCodeRemovingVolume is generated when we try remove a mount |
|
| 236 |
+ // point (volume) but fail. |
|
| 237 |
+ ErrorCodeRemovingVolume = errcode.Register(errGroup, errcode.ErrorDescriptor{
|
|
| 238 |
+ Value: "REMOVINGVOLUME", |
|
| 239 |
+ Message: "Error removing volumes:\n%v", |
|
| 240 |
+ HTTPStatusCode: http.StatusInternalServerError, |
|
| 241 |
+ }) |
|
| 242 |
+ |
|
| 243 |
+ // ErrorCodeInvalidNetworkMode is generated when an invalid network |
|
| 244 |
+ // mode value is specified. |
|
| 245 |
+ ErrorCodeInvalidNetworkMode = errcode.Register(errGroup, errcode.ErrorDescriptor{
|
|
| 246 |
+ Value: "INVALIDNETWORKMODE", |
|
| 247 |
+ Message: "invalid network mode: %s", |
|
| 248 |
+ HTTPStatusCode: http.StatusInternalServerError, |
|
| 249 |
+ }) |
|
| 250 |
+ |
|
| 251 |
+ // ErrorCodeGetGraph is generated when there was an error while |
|
| 252 |
+ // trying to find a graph/image. |
|
| 253 |
+ ErrorCodeGetGraph = errcode.Register(errGroup, errcode.ErrorDescriptor{
|
|
| 254 |
+ Value: "GETGRAPH", |
|
| 255 |
+ Message: "Failed to graph.Get on ImageID %s - %s", |
|
| 256 |
+ HTTPStatusCode: http.StatusInternalServerError, |
|
| 257 |
+ }) |
|
| 258 |
+ |
|
| 259 |
+ // ErrorCodeGetLayer is generated when there was an error while |
|
| 260 |
+ // trying to retrieve a particular layer of an image. |
|
| 261 |
+ ErrorCodeGetLayer = errcode.Register(errGroup, errcode.ErrorDescriptor{
|
|
| 262 |
+ Value: "GETLAYER", |
|
| 263 |
+ Message: "Failed to get layer path from graphdriver %s for ImageID %s - %s", |
|
| 264 |
+ HTTPStatusCode: http.StatusInternalServerError, |
|
| 265 |
+ }) |
|
| 266 |
+ |
|
| 267 |
+ // ErrorCodePutLayer is generated when there was an error while |
|
| 268 |
+ // trying to 'put' a particular layer of an image. |
|
| 269 |
+ ErrorCodePutLayer = errcode.Register(errGroup, errcode.ErrorDescriptor{
|
|
| 270 |
+ Value: "PUTLAYER", |
|
| 271 |
+ Message: "Failed to put layer path from graphdriver %s for ImageID %s - %s", |
|
| 272 |
+ HTTPStatusCode: http.StatusInternalServerError, |
|
| 273 |
+ }) |
|
| 274 |
+ |
|
| 275 |
+ // ErrorCodeGetLayerMetadata is generated when there was an error while |
|
| 276 |
+ // trying to retrieve the metadata of a layer of an image. |
|
| 277 |
+ ErrorCodeGetLayerMetadata = errcode.Register(errGroup, errcode.ErrorDescriptor{
|
|
| 278 |
+ Value: "GETLAYERMETADATA", |
|
| 279 |
+ Message: "Failed to get layer metadata - %s", |
|
| 280 |
+ HTTPStatusCode: http.StatusInternalServerError, |
|
| 281 |
+ }) |
|
| 282 |
+ |
|
| 283 |
+ // ErrorCodeEmptyConfig is generated when the input config data |
|
| 284 |
+ // is empty. |
|
| 285 |
+ ErrorCodeEmptyConfig = errcode.Register(errGroup, errcode.ErrorDescriptor{
|
|
| 286 |
+ Value: "EMPTYCONFIG", |
|
| 287 |
+ Message: "Config cannot be empty in order to create a container", |
|
| 288 |
+ HTTPStatusCode: http.StatusInternalServerError, |
|
| 289 |
+ }) |
|
| 290 |
+ |
|
| 291 |
+ // ErrorCodeNoSuchImageHash is generated when we can't find the |
|
| 292 |
+ // specified image by its hash |
|
| 293 |
+ ErrorCodeNoSuchImageHash = errcode.Register(errGroup, errcode.ErrorDescriptor{
|
|
| 294 |
+ Value: "NOSUCHIMAGEHASH", |
|
| 295 |
+ Message: "No such image: %s", |
|
| 296 |
+ HTTPStatusCode: http.StatusNotFound, |
|
| 297 |
+ }) |
|
| 298 |
+ |
|
| 299 |
+ // ErrorCodeNoSuchImageTag is generated when we can't find the |
|
| 300 |
+ // specified image byt its name/tag. |
|
| 301 |
+ ErrorCodeNoSuchImageTag = errcode.Register(errGroup, errcode.ErrorDescriptor{
|
|
| 302 |
+ Value: "NOSUCHIMAGETAG", |
|
| 303 |
+ Message: "No such image: %s:%s", |
|
| 304 |
+ HTTPStatusCode: http.StatusNotFound, |
|
| 305 |
+ }) |
|
| 306 |
+ |
|
| 307 |
+ // ErrorCodeMountOverFile is generated when we try to mount a volume |
|
| 308 |
+ // over an existing file (but not a dir). |
|
| 309 |
+ ErrorCodeMountOverFile = errcode.Register(errGroup, errcode.ErrorDescriptor{
|
|
| 310 |
+ Value: "MOUNTOVERFILE", |
|
| 311 |
+ Message: "cannot mount volume over existing file, file exists %s", |
|
| 312 |
+ HTTPStatusCode: http.StatusInternalServerError, |
|
| 313 |
+ }) |
|
| 314 |
+ |
|
| 315 |
+ // ErrorCodeMountSetup is generated when we can't define a mount point |
|
| 316 |
+ // due to the source and destination are defined. |
|
| 317 |
+ ErrorCodeMountSetup = errcode.Register(errGroup, errcode.ErrorDescriptor{
|
|
| 318 |
+ Value: "MOUNTSETUP", |
|
| 319 |
+ Message: "Unable to setup mount point, neither source nor volume defined", |
|
| 320 |
+ HTTPStatusCode: http.StatusInternalServerError, |
|
| 321 |
+ }) |
|
| 322 |
+ |
|
| 323 |
+ // ErrorCodeVolumeInvalidMode is generated when we the mode of a volume |
|
| 324 |
+ // mount is invalid. |
|
| 325 |
+ ErrorCodeVolumeInvalidMode = errcode.Register(errGroup, errcode.ErrorDescriptor{
|
|
| 326 |
+ Value: "VOLUMEINVALIDMODE", |
|
| 327 |
+ Message: "invalid mode for volumes-from: %s", |
|
| 328 |
+ HTTPStatusCode: http.StatusInternalServerError, |
|
| 329 |
+ }) |
|
| 330 |
+ |
|
| 331 |
+ // ErrorCodeVolumeInvalid is generated when the format fo the |
|
| 332 |
+ // volume specification isn't valid. |
|
| 333 |
+ ErrorCodeVolumeInvalid = errcode.Register(errGroup, errcode.ErrorDescriptor{
|
|
| 334 |
+ Value: "VOLUMEINVALID", |
|
| 335 |
+ Message: "Invalid volume specification: %s", |
|
| 336 |
+ HTTPStatusCode: http.StatusInternalServerError, |
|
| 337 |
+ }) |
|
| 338 |
+ |
|
| 339 |
+ // ErrorCodeVolumeAbs is generated when path to a volume isn't absolute. |
|
| 340 |
+ ErrorCodeVolumeAbs = errcode.Register(errGroup, errcode.ErrorDescriptor{
|
|
| 341 |
+ Value: "VOLUMEABS", |
|
| 342 |
+ Message: "Invalid volume destination path: %s mount path must be absolute.", |
|
| 343 |
+ HTTPStatusCode: http.StatusInternalServerError, |
|
| 344 |
+ }) |
|
| 345 |
+ |
|
| 346 |
+ // ErrorCodeVolumeFromBlank is generated when path to a volume is blank. |
|
| 347 |
+ ErrorCodeVolumeFromBlank = errcode.Register(errGroup, errcode.ErrorDescriptor{
|
|
| 348 |
+ Value: "VOLUMEFROMBLANK", |
|
| 349 |
+ Message: "malformed volumes-from specification: %s", |
|
| 350 |
+ HTTPStatusCode: http.StatusInternalServerError, |
|
| 351 |
+ }) |
|
| 352 |
+ |
|
| 353 |
+ // ErrorCodeVolumeMode is generated when 'mode' for a volume |
|
| 354 |
+ // isn't a valid. |
|
| 355 |
+ ErrorCodeVolumeMode = errcode.Register(errGroup, errcode.ErrorDescriptor{
|
|
| 356 |
+ Value: "VOLUMEMODE", |
|
| 357 |
+ Message: "invalid mode for volumes-from: %s", |
|
| 358 |
+ HTTPStatusCode: http.StatusInternalServerError, |
|
| 359 |
+ }) |
|
| 360 |
+ |
|
| 361 |
+ // ErrorCodeVolumeDup is generated when we try to mount two volumes |
|
| 362 |
+ // to the same path. |
|
| 363 |
+ ErrorCodeVolumeDup = errcode.Register(errGroup, errcode.ErrorDescriptor{
|
|
| 364 |
+ Value: "VOLUMEDUP", |
|
| 365 |
+ Message: "Duplicate bind mount %s", |
|
| 366 |
+ HTTPStatusCode: http.StatusInternalServerError, |
|
| 367 |
+ }) |
|
| 368 |
+ |
|
| 369 |
+ // ErrorCodeCantUnpause is generated when there's an error while trying |
|
| 370 |
+ // to unpause a container. |
|
| 371 |
+ ErrorCodeCantUnpause = errcode.Register(errGroup, errcode.ErrorDescriptor{
|
|
| 372 |
+ Value: "CANTUNPAUSE", |
|
| 373 |
+ Message: "Cannot unpause container %s: %s", |
|
| 374 |
+ HTTPStatusCode: http.StatusInternalServerError, |
|
| 375 |
+ }) |
|
| 376 |
+ |
|
| 377 |
+ // ErrorCodePSError is generated when trying to run 'ps'. |
|
| 378 |
+ ErrorCodePSError = errcode.Register(errGroup, errcode.ErrorDescriptor{
|
|
| 379 |
+ Value: "PSError", |
|
| 380 |
+ Message: "Error running ps: %s", |
|
| 381 |
+ HTTPStatusCode: http.StatusInternalServerError, |
|
| 382 |
+ }) |
|
| 383 |
+ |
|
| 384 |
+ // ErrorCodeNoPID is generated when looking for the PID field in the |
|
| 385 |
+ // ps output. |
|
| 386 |
+ ErrorCodeNoPID = errcode.Register(errGroup, errcode.ErrorDescriptor{
|
|
| 387 |
+ Value: "NOPID", |
|
| 388 |
+ Message: "Couldn't find PID field in ps output", |
|
| 389 |
+ HTTPStatusCode: http.StatusInternalServerError, |
|
| 390 |
+ }) |
|
| 391 |
+ |
|
| 392 |
+ // ErrorCodeBadPID is generated when we can't convert a PID to an int. |
|
| 393 |
+ ErrorCodeBadPID = errcode.Register(errGroup, errcode.ErrorDescriptor{
|
|
| 394 |
+ Value: "BADPID", |
|
| 395 |
+ Message: "Unexpected pid '%s': %s", |
|
| 396 |
+ HTTPStatusCode: http.StatusInternalServerError, |
|
| 397 |
+ }) |
|
| 398 |
+ |
|
| 399 |
+ // ErrorCodeNoTop is generated when we try to run 'top' but can't |
|
| 400 |
+ // because we're on windows. |
|
| 401 |
+ ErrorCodeNoTop = errcode.Register(errGroup, errcode.ErrorDescriptor{
|
|
| 402 |
+ Value: "NOTOP", |
|
| 403 |
+ Message: "Top is not supported on Windows", |
|
| 404 |
+ HTTPStatusCode: http.StatusInternalServerError, |
|
| 405 |
+ }) |
|
| 406 |
+ |
|
| 407 |
+ // ErrorCodeStopped is generated when we try to stop a container |
|
| 408 |
+ // that is already stopped. |
|
| 409 |
+ ErrorCodeStopped = errcode.Register(errGroup, errcode.ErrorDescriptor{
|
|
| 410 |
+ Value: "STOPPED", |
|
| 411 |
+ Message: "Container already stopped", |
|
| 412 |
+ HTTPStatusCode: http.StatusNotModified, |
|
| 413 |
+ }) |
|
| 414 |
+ |
|
| 415 |
+ // ErrorCodeCantStop is generated when we try to stop a container |
|
| 416 |
+ // but failed for some reason. |
|
| 417 |
+ ErrorCodeCantStop = errcode.Register(errGroup, errcode.ErrorDescriptor{
|
|
| 418 |
+ Value: "CANTSTOP", |
|
| 419 |
+ Message: "Cannot stop container %s: %s\n", |
|
| 420 |
+ HTTPStatusCode: http.StatusInternalServerError, |
|
| 421 |
+ }) |
|
| 422 |
+ |
|
| 423 |
+ // ErrorCodeBadCPUFields is generated the number of CPU fields is |
|
| 424 |
+ // less than 8. |
|
| 425 |
+ ErrorCodeBadCPUFields = errcode.Register(errGroup, errcode.ErrorDescriptor{
|
|
| 426 |
+ Value: "BADCPUFIELDS", |
|
| 427 |
+ Message: "invalid number of cpu fields", |
|
| 428 |
+ HTTPStatusCode: http.StatusInternalServerError, |
|
| 429 |
+ }) |
|
| 430 |
+ |
|
| 431 |
+ // ErrorCodeBadCPUInt is generated the CPU field can't be parsed as an int. |
|
| 432 |
+ ErrorCodeBadCPUInt = errcode.Register(errGroup, errcode.ErrorDescriptor{
|
|
| 433 |
+ Value: "BADCPUINT", |
|
| 434 |
+ Message: "Unable to convert value %s to int: %s", |
|
| 435 |
+ HTTPStatusCode: http.StatusInternalServerError, |
|
| 436 |
+ }) |
|
| 437 |
+ |
|
| 438 |
+ // ErrorCodeBadStatFormat is generated the output of the stat info |
|
| 439 |
+ // isn't parseable. |
|
| 440 |
+ ErrorCodeBadStatFormat = errcode.Register(errGroup, errcode.ErrorDescriptor{
|
|
| 441 |
+ Value: "BADSTATFORMAT", |
|
| 442 |
+ Message: "invalid stat format", |
|
| 443 |
+ HTTPStatusCode: http.StatusInternalServerError, |
|
| 444 |
+ }) |
|
| 445 |
+ |
|
| 446 |
+ // ErrorCodeTimedOut is generated when a timer expires. |
|
| 447 |
+ ErrorCodeTimedOut = errcode.Register(errGroup, errcode.ErrorDescriptor{
|
|
| 448 |
+ Value: "TIMEDOUT", |
|
| 449 |
+ Message: "Timed out: %v", |
|
| 450 |
+ HTTPStatusCode: http.StatusInternalServerError, |
|
| 451 |
+ }) |
|
| 452 |
+ |
|
| 453 |
+ // ErrorCodeAlreadyRemoving is generated when we try to remove a |
|
| 454 |
+ // container that is already being removed. |
|
| 455 |
+ ErrorCodeAlreadyRemoving = errcode.Register(errGroup, errcode.ErrorDescriptor{
|
|
| 456 |
+ Value: "ALREADYREMOVING", |
|
| 457 |
+ Message: "Status is already RemovalInProgress", |
|
| 458 |
+ HTTPStatusCode: http.StatusInternalServerError, |
|
| 459 |
+ }) |
|
| 460 |
+ |
|
| 461 |
+ // ErrorCodeStartPaused is generated when we start a paused container. |
|
| 462 |
+ ErrorCodeStartPaused = errcode.Register(errGroup, errcode.ErrorDescriptor{
|
|
| 463 |
+ Value: "STARTPAUSED", |
|
| 464 |
+ Message: "Cannot start a paused container, try unpause instead.", |
|
| 465 |
+ HTTPStatusCode: http.StatusInternalServerError, |
|
| 466 |
+ }) |
|
| 467 |
+ |
|
| 468 |
+ // ErrorCodeAlreadyStarted is generated when we try to start a container |
|
| 469 |
+ // that is already running. |
|
| 470 |
+ ErrorCodeAlreadyStarted = errcode.Register(errGroup, errcode.ErrorDescriptor{
|
|
| 471 |
+ Value: "ALREADYSTARTED", |
|
| 472 |
+ Message: "Container already started", |
|
| 473 |
+ HTTPStatusCode: http.StatusNotModified, |
|
| 474 |
+ }) |
|
| 475 |
+ |
|
| 476 |
+ // ErrorCodeHostConfigStart is generated when a HostConfig is passed |
|
| 477 |
+ // into the start command. |
|
| 478 |
+ ErrorCodeHostConfigStart = errcode.Register(errGroup, errcode.ErrorDescriptor{
|
|
| 479 |
+ Value: "HOSTCONFIGSTART", |
|
| 480 |
+ Message: "Supplying a hostconfig on start is not supported. It should be supplied on create", |
|
| 481 |
+ HTTPStatusCode: http.StatusInternalServerError, |
|
| 482 |
+ }) |
|
| 483 |
+ |
|
| 484 |
+ // ErrorCodeCantStart is generated when an error occurred while |
|
| 485 |
+ // trying to start a container. |
|
| 486 |
+ ErrorCodeCantStart = errcode.Register(errGroup, errcode.ErrorDescriptor{
|
|
| 487 |
+ Value: "CANTSTART", |
|
| 488 |
+ Message: "Cannot start container %s: %s", |
|
| 489 |
+ HTTPStatusCode: http.StatusInternalServerError, |
|
| 490 |
+ }) |
|
| 491 |
+) |