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