github.com/fntlnz/docker@v1.9.0-rc3/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  	// ErrorCodeVolumeName is generated when the name of named volume isn't valid.
   389  	ErrorCodeVolumeName = errcode.Register(errGroup, errcode.ErrorDescriptor{
   390  		Value:          "VOLUME_NAME_INVALID",
   391  		Message:        "%s includes invalid characters for a local volume name, only %s are allowed",
   392  		Description:    "The name of volume is invalid",
   393  		HTTPStatusCode: http.StatusBadRequest,
   394  	})
   395  
   396  	// ErrorCodeVolumeFromBlank is generated when path to a volume is blank.
   397  	ErrorCodeVolumeFromBlank = errcode.Register(errGroup, errcode.ErrorDescriptor{
   398  		Value:          "VOLUMEFROMBLANK",
   399  		Message:        "malformed volumes-from specification: %s",
   400  		Description:    "An invalid 'destination' path was specified in the mount request, it must not be blank",
   401  		HTTPStatusCode: http.StatusInternalServerError,
   402  	})
   403  
   404  	// ErrorCodeVolumeMode is generated when 'mode' for a volume
   405  	// isn't a valid.
   406  	ErrorCodeVolumeMode = errcode.Register(errGroup, errcode.ErrorDescriptor{
   407  		Value:          "VOLUMEMODE",
   408  		Message:        "invalid mode for volumes-from: %s",
   409  		Description:    "An invalid 'mode' path was specified in the mount request",
   410  		HTTPStatusCode: http.StatusInternalServerError,
   411  	})
   412  
   413  	// ErrorCodeVolumeDup is generated when we try to mount two volumes
   414  	// to the same path.
   415  	ErrorCodeVolumeDup = errcode.Register(errGroup, errcode.ErrorDescriptor{
   416  		Value:          "VOLUMEDUP",
   417  		Message:        "Duplicate bind mount %s",
   418  		Description:    "An attempt was made to mount a volume but the specified destination location is already used in a previous mount",
   419  		HTTPStatusCode: http.StatusInternalServerError,
   420  	})
   421  
   422  	// ErrorCodeCantUnpause is generated when there's an error while trying
   423  	// to unpause a container.
   424  	ErrorCodeCantUnpause = errcode.Register(errGroup, errcode.ErrorDescriptor{
   425  		Value:          "CANTUNPAUSE",
   426  		Message:        "Cannot unpause container %s: %s",
   427  		Description:    "An error occurred while trying to unpause the specified container",
   428  		HTTPStatusCode: http.StatusInternalServerError,
   429  	})
   430  
   431  	// ErrorCodePSError is generated when trying to run 'ps'.
   432  	ErrorCodePSError = errcode.Register(errGroup, errcode.ErrorDescriptor{
   433  		Value:          "PSError",
   434  		Message:        "Error running ps: %s",
   435  		Description:    "There was an error trying to run the 'ps' command in the specified container",
   436  		HTTPStatusCode: http.StatusInternalServerError,
   437  	})
   438  
   439  	// ErrorCodeNoPID is generated when looking for the PID field in the
   440  	// ps output.
   441  	ErrorCodeNoPID = errcode.Register(errGroup, errcode.ErrorDescriptor{
   442  		Value:          "NOPID",
   443  		Message:        "Couldn't find PID field in ps output",
   444  		Description:    "There was no 'PID' field in the output of the 'ps' command that was executed",
   445  		HTTPStatusCode: http.StatusInternalServerError,
   446  	})
   447  
   448  	// ErrorCodeBadPID is generated when we can't convert a PID to an int.
   449  	ErrorCodeBadPID = errcode.Register(errGroup, errcode.ErrorDescriptor{
   450  		Value:          "BADPID",
   451  		Message:        "Unexpected pid '%s': %s",
   452  		Description:    "While trying to parse the output of the 'ps' command, the 'PID' field was not an integer",
   453  		HTTPStatusCode: http.StatusInternalServerError,
   454  	})
   455  
   456  	// ErrorCodeNoTop is generated when we try to run 'top' but can't
   457  	// because we're on windows.
   458  	ErrorCodeNoTop = errcode.Register(errGroup, errcode.ErrorDescriptor{
   459  		Value:          "NOTOP",
   460  		Message:        "Top is not supported on Windows",
   461  		Description:    "The 'top' command is not supported on Windows",
   462  		HTTPStatusCode: http.StatusInternalServerError,
   463  	})
   464  
   465  	// ErrorCodeStopped is generated when we try to stop a container
   466  	// that is already stopped.
   467  	ErrorCodeStopped = errcode.Register(errGroup, errcode.ErrorDescriptor{
   468  		Value:          "STOPPED",
   469  		Message:        "Container already stopped",
   470  		Description:    "An attempt was made to stop a container, but the container is already stopped",
   471  		HTTPStatusCode: http.StatusNotModified,
   472  	})
   473  
   474  	// ErrorCodeCantStop is generated when we try to stop a container
   475  	// but failed for some reason.
   476  	ErrorCodeCantStop = errcode.Register(errGroup, errcode.ErrorDescriptor{
   477  		Value:          "CANTSTOP",
   478  		Message:        "Cannot stop container %s: %s\n",
   479  		Description:    "An error occurred while tring to stop the specified container",
   480  		HTTPStatusCode: http.StatusInternalServerError,
   481  	})
   482  
   483  	// ErrorCodeBadCPUFields is generated when the number of CPU fields is
   484  	// less than 8.
   485  	ErrorCodeBadCPUFields = errcode.Register(errGroup, errcode.ErrorDescriptor{
   486  		Value:          "BADCPUFIELDS",
   487  		Message:        "invalid number of cpu fields",
   488  		Description:    "While reading the '/proc/stat' file, the number of 'cpu' fields is less than 8",
   489  		HTTPStatusCode: http.StatusInternalServerError,
   490  	})
   491  
   492  	// ErrorCodeBadCPUInt is generated the CPU field can't be parsed as an int.
   493  	ErrorCodeBadCPUInt = errcode.Register(errGroup, errcode.ErrorDescriptor{
   494  		Value:          "BADCPUINT",
   495  		Message:        "Unable to convert value %s to int: %s",
   496  		Description:    "While reading the '/proc/stat' file, the 'CPU' field could not be parsed as an integer",
   497  		HTTPStatusCode: http.StatusInternalServerError,
   498  	})
   499  
   500  	// ErrorCodeBadStatFormat is generated the output of the stat info
   501  	// isn't parseable.
   502  	ErrorCodeBadStatFormat = errcode.Register(errGroup, errcode.ErrorDescriptor{
   503  		Value:          "BADSTATFORMAT",
   504  		Message:        "invalid stat format",
   505  		Description:    "There was an error trying to parse the '/proc/stat' file",
   506  		HTTPStatusCode: http.StatusInternalServerError,
   507  	})
   508  
   509  	// ErrorCodeTimedOut is generated when a timer expires.
   510  	ErrorCodeTimedOut = errcode.Register(errGroup, errcode.ErrorDescriptor{
   511  		Value:          "TIMEDOUT",
   512  		Message:        "Timed out: %v",
   513  		Description:    "A timer expired",
   514  		HTTPStatusCode: http.StatusInternalServerError,
   515  	})
   516  
   517  	// ErrorCodeAlreadyRemoving is generated when we try to remove a
   518  	// container that is already being removed.
   519  	ErrorCodeAlreadyRemoving = errcode.Register(errGroup, errcode.ErrorDescriptor{
   520  		Value:          "ALREADYREMOVING",
   521  		Message:        "Status is already RemovalInProgress",
   522  		Description:    "An attempt to remove a container was made, but the container is already in the process of being removed",
   523  		HTTPStatusCode: http.StatusInternalServerError,
   524  	})
   525  
   526  	// ErrorCodeStartPaused is generated when we start a paused container.
   527  	ErrorCodeStartPaused = errcode.Register(errGroup, errcode.ErrorDescriptor{
   528  		Value:          "STARTPAUSED",
   529  		Message:        "Cannot start a paused container, try unpause instead.",
   530  		Description:    "An attempt to start a container was made, but the container is paused. Unpause it first",
   531  		HTTPStatusCode: http.StatusInternalServerError,
   532  	})
   533  
   534  	// ErrorCodeAlreadyStarted is generated when we try to start a container
   535  	// that is already running.
   536  	ErrorCodeAlreadyStarted = errcode.Register(errGroup, errcode.ErrorDescriptor{
   537  		Value:          "ALREADYSTARTED",
   538  		Message:        "Container already started",
   539  		Description:    "An attempt to start a container was made, but the container is already started",
   540  		HTTPStatusCode: http.StatusNotModified,
   541  	})
   542  
   543  	// ErrorCodeHostConfigStart is generated when a HostConfig is passed
   544  	// into the start command.
   545  	ErrorCodeHostConfigStart = errcode.Register(errGroup, errcode.ErrorDescriptor{
   546  		Value:          "HOSTCONFIGSTART",
   547  		Message:        "Supplying a hostconfig on start is not supported. It should be supplied on create",
   548  		Description:    "The 'start' command does not accept 'HostConfig' data, try using the 'create' command instead",
   549  		HTTPStatusCode: http.StatusInternalServerError,
   550  	})
   551  
   552  	// ErrorCodeCantStart is generated when an error occurred while
   553  	// trying to start a container.
   554  	ErrorCodeCantStart = errcode.Register(errGroup, errcode.ErrorDescriptor{
   555  		Value:          "CANTSTART",
   556  		Message:        "Cannot start container %s: %s",
   557  		Description:    "There was an error while trying to start a container",
   558  		HTTPStatusCode: http.StatusInternalServerError,
   559  	})
   560  
   561  	// ErrorCodeCantRestart is generated when an error occurred while
   562  	// trying to restart a container.
   563  	ErrorCodeCantRestart = errcode.Register(errGroup, errcode.ErrorDescriptor{
   564  		Value:          "CANTRESTART",
   565  		Message:        "Cannot restart container %s: %s",
   566  		Description:    "There was an error while trying to restart a container",
   567  		HTTPStatusCode: http.StatusInternalServerError,
   568  	})
   569  
   570  	// ErrorCodeEmptyRename is generated when one of the names on a
   571  	// rename is empty.
   572  	ErrorCodeEmptyRename = errcode.Register(errGroup, errcode.ErrorDescriptor{
   573  		Value:          "EMPTYRENAME",
   574  		Message:        "Neither old nor new names may be empty",
   575  		Description:    "An attempt was made to rename a container but either the old or new names were blank",
   576  		HTTPStatusCode: http.StatusInternalServerError,
   577  	})
   578  
   579  	// ErrorCodeRenameTaken is generated when we try to rename but the
   580  	// new name isn't available.
   581  	ErrorCodeRenameTaken = errcode.Register(errGroup, errcode.ErrorDescriptor{
   582  		Value:          "RENAMETAKEN",
   583  		Message:        "Error when allocating new name: %s",
   584  		Description:    "The new name specified on the 'rename' command is already being used",
   585  		HTTPStatusCode: http.StatusInternalServerError,
   586  	})
   587  
   588  	// ErrorCodeRenameDelete is generated when we try to rename but
   589  	// failed trying to delete the old container.
   590  	ErrorCodeRenameDelete = errcode.Register(errGroup, errcode.ErrorDescriptor{
   591  		Value:          "RENAMEDELETE",
   592  		Message:        "Failed to delete container %q: %v",
   593  		Description:    "There was an error trying to delete the specified container",
   594  		HTTPStatusCode: http.StatusInternalServerError,
   595  	})
   596  
   597  	// ErrorCodePauseError is generated when we try to pause a container
   598  	// but failed.
   599  	ErrorCodePauseError = errcode.Register(errGroup, errcode.ErrorDescriptor{
   600  		Value:          "PAUSEERROR",
   601  		Message:        "Cannot pause container %s: %s",
   602  		Description:    "There was an error trying to pause the specified container",
   603  		HTTPStatusCode: http.StatusInternalServerError,
   604  	})
   605  
   606  	// ErrorCodeNeedStream is generated when we try to stream a container's
   607  	// logs but no output stream was specified.
   608  	ErrorCodeNeedStream = errcode.Register(errGroup, errcode.ErrorDescriptor{
   609  		Value:          "NEEDSTREAM",
   610  		Message:        "You must choose at least one stream",
   611  		Description:    "While trying to stream a container's logs, no output stream was specified",
   612  		HTTPStatusCode: http.StatusInternalServerError,
   613  	})
   614  
   615  	// ErrorCodeDanglingOne is generated when we try to specify more than one
   616  	// 'dangling' specifier.
   617  	ErrorCodeDanglingOne = errcode.Register(errGroup, errcode.ErrorDescriptor{
   618  		Value:          "DANLGINGONE",
   619  		Message:        "Conflict: cannot use more than 1 value for `dangling` filter",
   620  		Description:    "The specified 'dangling' filter may not have more than one value",
   621  		HTTPStatusCode: http.StatusConflict,
   622  	})
   623  
   624  	// ErrorCodeImgDelUsed is generated when we try to delete an image
   625  	// but it is being used.
   626  	ErrorCodeImgDelUsed = errcode.Register(errGroup, errcode.ErrorDescriptor{
   627  		Value:          "IMGDELUSED",
   628  		Message:        "conflict: unable to remove repository reference %q (must force) - container %s is using its referenced image %s",
   629  		Description:    "An attempt was made to delete an image but it is currently being used",
   630  		HTTPStatusCode: http.StatusConflict,
   631  	})
   632  
   633  	// ErrorCodeImgNoParent is generated when we try to find an image's
   634  	// parent but its not in the graph.
   635  	ErrorCodeImgNoParent = errcode.Register(errGroup, errcode.ErrorDescriptor{
   636  		Value:          "IMGNOPARENT",
   637  		Message:        "unable to get parent image: %v",
   638  		Description:    "There was an error trying to find an image's parent, it was not in the graph",
   639  		HTTPStatusCode: http.StatusInternalServerError,
   640  	})
   641  
   642  	// ErrorCodeExportFailed is generated when an export fails.
   643  	ErrorCodeExportFailed = errcode.Register(errGroup, errcode.ErrorDescriptor{
   644  		Value:          "EXPORTFAILED",
   645  		Message:        "%s: %s",
   646  		Description:    "There was an error during an export operation",
   647  		HTTPStatusCode: http.StatusInternalServerError,
   648  	})
   649  
   650  	// ErrorCodeExecResize is generated when we try to resize an exec
   651  	// but its not running.
   652  	ErrorCodeExecResize = errcode.Register(errGroup, errcode.ErrorDescriptor{
   653  		Value:          "EXECRESIZE",
   654  		Message:        "Exec %s is not running, so it can not be resized.",
   655  		Description:    "An attempt was made to resize an 'exec', but the 'exec' is not running",
   656  		HTTPStatusCode: http.StatusInternalServerError,
   657  	})
   658  
   659  	// ErrorCodeContainerNotRunning is generated when we try to get the info
   660  	// on an exec but the container is not running.
   661  	ErrorCodeContainerNotRunning = errcode.Register(errGroup, errcode.ErrorDescriptor{
   662  		Value:          "CONTAINERNOTRUNNING",
   663  		Message:        "Container %s is not running: %s",
   664  		Description:    "An attempt was made to retrieve the information about an 'exec' but the container is not running",
   665  		HTTPStatusCode: http.StatusConflict,
   666  	})
   667  
   668  	// ErrorCodeNoExecID is generated when we try to get the info
   669  	// on an exec but it can't be found.
   670  	ErrorCodeNoExecID = errcode.Register(errGroup, errcode.ErrorDescriptor{
   671  		Value:          "NOEXECID",
   672  		Message:        "No such exec instance '%s' found in daemon",
   673  		Description:    "The specified 'exec' instance could not be found",
   674  		HTTPStatusCode: http.StatusNotFound,
   675  	})
   676  
   677  	// ErrorCodeExecPaused is generated when we try to start an exec
   678  	// but the container is paused.
   679  	ErrorCodeExecPaused = errcode.Register(errGroup, errcode.ErrorDescriptor{
   680  		Value:          "EXECPAUSED",
   681  		Message:        "Container %s is paused, unpause the container before exec",
   682  		Description:    "An attempt to start an 'exec' was made, but the owning container is paused",
   683  		HTTPStatusCode: http.StatusConflict,
   684  	})
   685  
   686  	// ErrorCodeExecRunning is generated when we try to start an exec
   687  	// but its already running.
   688  	ErrorCodeExecRunning = errcode.Register(errGroup, errcode.ErrorDescriptor{
   689  		Value:          "EXECRUNNING",
   690  		Message:        "Error: Exec command %s is already running",
   691  		Description:    "An attempt to start an 'exec' was made, but 'exec' is already running",
   692  		HTTPStatusCode: http.StatusInternalServerError,
   693  	})
   694  
   695  	// ErrorCodeExecCantRun is generated when we try to start an exec
   696  	// but it failed for some reason.
   697  	ErrorCodeExecCantRun = errcode.Register(errGroup, errcode.ErrorDescriptor{
   698  		Value:          "EXECCANTRUN",
   699  		Message:        "Cannot run exec command %s in container %s: %s",
   700  		Description:    "An attempt to start an 'exec' was made, but an error occurred",
   701  		HTTPStatusCode: http.StatusInternalServerError,
   702  	})
   703  
   704  	// ErrorCodeExecAttach is generated when we try to attach to an exec
   705  	// but failed.
   706  	ErrorCodeExecAttach = errcode.Register(errGroup, errcode.ErrorDescriptor{
   707  		Value:          "EXECATTACH",
   708  		Message:        "attach failed with error: %s",
   709  		Description:    "There was an error while trying to attach to an 'exec'",
   710  		HTTPStatusCode: http.StatusInternalServerError,
   711  	})
   712  
   713  	// ErrorCodeExecContainerStopped is generated when we try to start
   714  	// an exec but then the container stopped.
   715  	ErrorCodeExecContainerStopped = errcode.Register(errGroup, errcode.ErrorDescriptor{
   716  		Value:          "EXECCONTAINERSTOPPED",
   717  		Message:        "container stopped while running exec",
   718  		Description:    "An attempt was made to start an 'exec' but the owning container is in the 'stopped' state",
   719  		HTTPStatusCode: http.StatusInternalServerError,
   720  	})
   721  
   722  	// ErrorCodeDefaultName is generated when we try to delete the
   723  	// default name of a container.
   724  	ErrorCodeDefaultName = errcode.Register(errGroup, errcode.ErrorDescriptor{
   725  		Value:          "DEFAULTNAME",
   726  		Message:        "Conflict, cannot remove the default name of the container",
   727  		Description:    "An attempt to delete the default name of a container was made, but that is not allowed",
   728  		HTTPStatusCode: http.StatusConflict,
   729  	})
   730  
   731  	// ErrorCodeNoParent is generated when we try to delete a container
   732  	// but we can't find its parent image.
   733  	ErrorCodeNoParent = errcode.Register(errGroup, errcode.ErrorDescriptor{
   734  		Value:          "NOPARENT",
   735  		Message:        "Cannot get parent %s for name %s",
   736  		Description:    "An attempt was made to delete a container but its parent image could not be found",
   737  		HTTPStatusCode: http.StatusInternalServerError,
   738  	})
   739  
   740  	// ErrorCodeCantDestroy is generated when we try to delete a container
   741  	// but failed for some reason.
   742  	ErrorCodeCantDestroy = errcode.Register(errGroup, errcode.ErrorDescriptor{
   743  		Value:          "CANTDESTROY",
   744  		Message:        "Cannot destroy container %s: %v",
   745  		Description:    "An attempt was made to delete a container but it failed",
   746  		HTTPStatusCode: http.StatusInternalServerError,
   747  	})
   748  
   749  	// ErrorCodeRmRunning is generated when we try to delete a container
   750  	// but its still running.
   751  	ErrorCodeRmRunning = errcode.Register(errGroup, errcode.ErrorDescriptor{
   752  		Value:          "RMRUNNING",
   753  		Message:        "Conflict, You cannot remove a running container. Stop the container before attempting removal or use -f",
   754  		Description:    "An attempt was made to delete a container but the container is still running, try to either stop it first or use '-f'",
   755  		HTTPStatusCode: http.StatusConflict,
   756  	})
   757  
   758  	// ErrorCodeRmFailed is generated when we try to delete a container
   759  	// but it failed for some reason.
   760  	ErrorCodeRmFailed = errcode.Register(errGroup, errcode.ErrorDescriptor{
   761  		Value:          "RMFAILED",
   762  		Message:        "Could not kill running container, cannot remove - %v",
   763  		Description:    "An error occurred while trying to delete a running container",
   764  		HTTPStatusCode: http.StatusInternalServerError,
   765  	})
   766  
   767  	// ErrorCodeRmNotFound is generated when we try to delete a container
   768  	// but couldn't find it.
   769  	ErrorCodeRmNotFound = errcode.Register(errGroup, errcode.ErrorDescriptor{
   770  		Value:          "RMNOTFOUND",
   771  		Message:        "Could not kill running container, cannot remove - %v",
   772  		Description:    "An attempt to delete a container was made but the container could not be found",
   773  		HTTPStatusCode: http.StatusInternalServerError,
   774  	})
   775  
   776  	// ErrorCodeRmState is generated when we try to delete a container
   777  	// but couldn't set its state to RemovalInProgress.
   778  	ErrorCodeRmState = errcode.Register(errGroup, errcode.ErrorDescriptor{
   779  		Value:          "RMSTATE",
   780  		Message:        "Failed to set container state to RemovalInProgress: %s",
   781  		Description:    "An attempt to delete a container was made, but there as an error trying to set its state to 'RemovalInProgress'",
   782  		HTTPStatusCode: http.StatusInternalServerError,
   783  	})
   784  
   785  	// ErrorCodeRmDriverFS is generated when we try to delete a container
   786  	// but the driver failed to delete its filesystem.
   787  	ErrorCodeRmDriverFS = errcode.Register(errGroup, errcode.ErrorDescriptor{
   788  		Value:          "RMDRIVERFS",
   789  		Message:        "Driver %s failed to remove root filesystem %s: %s",
   790  		Description:    "While trying to delete a container, the driver failed to remove the root filesystem",
   791  		HTTPStatusCode: http.StatusInternalServerError,
   792  	})
   793  
   794  	// ErrorCodeRmInit is generated when we try to delete a container
   795  	// but failed deleting its init filesystem.
   796  	ErrorCodeRmInit = errcode.Register(errGroup, errcode.ErrorDescriptor{
   797  		Value:          "RMINIT",
   798  		Message:        "Driver %s failed to remove init filesystem %s: %s",
   799  		Description:    "While trying to delete a container, the driver failed to remove the init filesystem",
   800  		HTTPStatusCode: http.StatusInternalServerError,
   801  	})
   802  
   803  	// ErrorCodeRmFS is generated when we try to delete a container
   804  	// but failed deleting its filesystem.
   805  	ErrorCodeRmFS = errcode.Register(errGroup, errcode.ErrorDescriptor{
   806  		Value:          "RMFS",
   807  		Message:        "Unable to remove filesystem for %v: %v",
   808  		Description:    "While trying to delete a container, the driver failed to remove the filesystem",
   809  		HTTPStatusCode: http.StatusInternalServerError,
   810  	})
   811  
   812  	// ErrorCodeRmExecDriver is generated when we try to delete a container
   813  	// but failed deleting its exec driver data.
   814  	ErrorCodeRmExecDriver = errcode.Register(errGroup, errcode.ErrorDescriptor{
   815  		Value:          "RMEXECDRIVER",
   816  		Message:        "Unable to remove execdriver data for %s: %s",
   817  		Description:    "While trying to delete a container, there was an error trying to remove th exec driver data",
   818  		HTTPStatusCode: http.StatusInternalServerError,
   819  	})
   820  
   821  	// ErrorCodeRmVolumeInUse is generated when we try to delete a container
   822  	// but failed deleting a volume because its being used.
   823  	ErrorCodeRmVolumeInUse = errcode.Register(errGroup, errcode.ErrorDescriptor{
   824  		Value:          "RMVOLUMEINUSE",
   825  		Message:        "Conflict: %v",
   826  		Description:    "While trying to delete a container, one of its volumes is still being used",
   827  		HTTPStatusCode: http.StatusConflict,
   828  	})
   829  
   830  	// ErrorCodeRmVolume is generated when we try to delete a container
   831  	// but failed deleting a volume.
   832  	ErrorCodeRmVolume = errcode.Register(errGroup, errcode.ErrorDescriptor{
   833  		Value:          "RMVOLUME",
   834  		Message:        "Error while removing volume %s: %v",
   835  		Description:    "While trying to delete a container, there was an error trying to delete one of its volumes",
   836  		HTTPStatusCode: http.StatusInternalServerError,
   837  	})
   838  
   839  	// ErrorCodeInvalidCpusetCpus is generated when user provided cpuset CPUs
   840  	// are invalid.
   841  	ErrorCodeInvalidCpusetCpus = errcode.Register(errGroup, errcode.ErrorDescriptor{
   842  		Value:          "INVALIDCPUSETCPUS",
   843  		Message:        "Invalid value %s for cpuset cpus.",
   844  		Description:    "While verifying the container's 'HostConfig', CpusetCpus value was in an incorrect format",
   845  		HTTPStatusCode: http.StatusInternalServerError,
   846  	})
   847  
   848  	// ErrorCodeInvalidCpusetMems is generated when user provided cpuset mems
   849  	// are invalid.
   850  	ErrorCodeInvalidCpusetMems = errcode.Register(errGroup, errcode.ErrorDescriptor{
   851  		Value:          "INVALIDCPUSETMEMS",
   852  		Message:        "Invalid value %s for cpuset mems.",
   853  		Description:    "While verifying the container's 'HostConfig', CpusetMems value was in an incorrect format",
   854  		HTTPStatusCode: http.StatusInternalServerError,
   855  	})
   856  
   857  	// ErrorCodeNotAvailableCpusetCpus is generated when user provided cpuset
   858  	// CPUs aren't available in the container's cgroup.
   859  	ErrorCodeNotAvailableCpusetCpus = errcode.Register(errGroup, errcode.ErrorDescriptor{
   860  		Value:          "NOTAVAILABLECPUSETCPUS",
   861  		Message:        "Requested CPUs are not available - requested %s, available: %s.",
   862  		Description:    "While verifying the container's 'HostConfig', cpuset CPUs provided aren't available in the container's cgroup available set",
   863  		HTTPStatusCode: http.StatusInternalServerError,
   864  	})
   865  
   866  	// ErrorCodeNotAvailableCpusetMems is generated when user provided cpuset
   867  	// memory nodes aren't available in the container's cgroup.
   868  	ErrorCodeNotAvailableCpusetMems = errcode.Register(errGroup, errcode.ErrorDescriptor{
   869  		Value:          "NOTAVAILABLECPUSETMEMS",
   870  		Message:        "Requested memory nodes are not available - requested %s, available: %s.",
   871  		Description:    "While verifying the container's 'HostConfig', cpuset memory nodes provided aren't available in the container's cgroup available set",
   872  		HTTPStatusCode: http.StatusInternalServerError,
   873  	})
   874  
   875  	// ErrorVolumeNameTaken is generated when an error occurred while
   876  	// trying to create a volume that has existed using different driver.
   877  	ErrorVolumeNameTaken = errcode.Register(errGroup, errcode.ErrorDescriptor{
   878  		Value:          "VOLUME_NAME_TAKEN",
   879  		Message:        "A volume name %s already exists with the %s driver. Choose a different volume name.",
   880  		Description:    "An attempt to create a volume using a driver but the volume already exists with a different driver",
   881  		HTTPStatusCode: http.StatusInternalServerError,
   882  	})
   883  )