mirror of
https://github.com/clearlinux/docker.git
synced 2026-09-03 20:21:44 +00:00
Merge pull request #16411 from duglin/DaemonErrors
Move more 'daemon' errors to the new error package
This commit is contained in:
@@ -18,6 +18,7 @@ import (
|
||||
"github.com/docker/docker/context"
|
||||
"github.com/docker/docker/daemon"
|
||||
"github.com/docker/docker/pkg/sockets"
|
||||
"github.com/docker/docker/utils"
|
||||
)
|
||||
|
||||
// Config provides the configuration for the API server
|
||||
@@ -248,7 +249,7 @@ func httpError(w http.ResponseWriter, err error) {
|
||||
statusCode = http.StatusInternalServerError
|
||||
}
|
||||
|
||||
logrus.WithFields(logrus.Fields{"statusCode": statusCode, "err": err}).Error("HTTP Error")
|
||||
logrus.WithFields(logrus.Fields{"statusCode": statusCode, "err": utils.GetErrorMessage(err)}).Error("HTTP Error")
|
||||
http.Error(w, errMsg, statusCode)
|
||||
}
|
||||
|
||||
@@ -305,7 +306,7 @@ func (s *Server) makeHTTPHandler(localMethod string, localRoute string, localHan
|
||||
handlerFunc := s.handleWithGlobalMiddlewares(localHandler)
|
||||
|
||||
if err := handlerFunc(ctx, w, r, mux.Vars(r)); err != nil {
|
||||
logrus.Errorf("Handler for %s %s returned error: %s", localMethod, localRoute, err)
|
||||
logrus.Errorf("Handler for %s %s returned error: %s", localMethod, localRoute, utils.GetErrorMessage(err))
|
||||
httpError(w, err)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -973,7 +973,7 @@ func (container *Container) setNetworkNamespaceKey(pid int) error {
|
||||
search := libnetwork.SandboxContainerWalker(&sandbox, container.ID)
|
||||
container.daemon.netController.WalkSandboxes(search)
|
||||
if sandbox == nil {
|
||||
return fmt.Errorf("no sandbox present for %s", container.ID)
|
||||
return derr.ErrorCodeNoSandbox.WithArgs(container.ID)
|
||||
}
|
||||
|
||||
return sandbox.SetKey(path)
|
||||
|
||||
+15
-13
@@ -6,6 +6,7 @@ import (
|
||||
"path"
|
||||
|
||||
"github.com/Sirupsen/logrus"
|
||||
derr "github.com/docker/docker/errors"
|
||||
"github.com/docker/docker/volume/store"
|
||||
)
|
||||
|
||||
@@ -31,11 +32,11 @@ func (daemon *Daemon) ContainerRm(name string, config *ContainerRmConfig) error
|
||||
}
|
||||
parent, n := path.Split(name)
|
||||
if parent == "/" {
|
||||
return fmt.Errorf("Conflict, cannot remove the default name of the container")
|
||||
return derr.ErrorCodeDefaultName
|
||||
}
|
||||
pe := daemon.containerGraph().Get(parent)
|
||||
if pe == nil {
|
||||
return fmt.Errorf("Cannot get parent %s for name %s", parent, name)
|
||||
return derr.ErrorCodeNoParent.WithArgs(parent, name)
|
||||
}
|
||||
|
||||
if err := daemon.containerGraph().Delete(name); err != nil {
|
||||
@@ -53,7 +54,8 @@ func (daemon *Daemon) ContainerRm(name string, config *ContainerRmConfig) error
|
||||
}
|
||||
|
||||
if err := daemon.rm(container, config.ForceRemove); err != nil {
|
||||
return fmt.Errorf("Cannot destroy container %s: %v", name, err)
|
||||
// return derr.ErrorCodeCantDestroy.WithArgs(name, utils.GetErrorMessage(err))
|
||||
return err
|
||||
}
|
||||
|
||||
if err := container.removeMountPoints(config.RemoveVolume); err != nil {
|
||||
@@ -67,10 +69,10 @@ func (daemon *Daemon) ContainerRm(name string, config *ContainerRmConfig) error
|
||||
func (daemon *Daemon) rm(container *Container, forceRemove bool) (err error) {
|
||||
if container.IsRunning() {
|
||||
if !forceRemove {
|
||||
return fmt.Errorf("Conflict, You cannot remove a running container. Stop the container before attempting removal or use -f")
|
||||
return derr.ErrorCodeRmRunning
|
||||
}
|
||||
if err := container.Kill(); err != nil {
|
||||
return fmt.Errorf("Could not kill running container, cannot remove - %v", err)
|
||||
return derr.ErrorCodeRmFailed.WithArgs(err)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -80,12 +82,12 @@ func (daemon *Daemon) rm(container *Container, forceRemove bool) (err error) {
|
||||
|
||||
element := daemon.containers.Get(container.ID)
|
||||
if element == nil {
|
||||
return fmt.Errorf("Container %v not found - maybe it was already destroyed?", container.ID)
|
||||
return derr.ErrorCodeRmNotFound.WithArgs(container.ID)
|
||||
}
|
||||
|
||||
// Container state RemovalInProgress should be used to avoid races.
|
||||
if err = container.setRemovalInProgress(); err != nil {
|
||||
return fmt.Errorf("Failed to set container state to RemovalInProgress: %s", err)
|
||||
return derr.ErrorCodeRmState.WithArgs(err)
|
||||
}
|
||||
|
||||
defer container.resetRemovalInProgress()
|
||||
@@ -120,20 +122,20 @@ func (daemon *Daemon) rm(container *Container, forceRemove bool) (err error) {
|
||||
}
|
||||
|
||||
if err = daemon.driver.Remove(container.ID); err != nil {
|
||||
return fmt.Errorf("Driver %s failed to remove root filesystem %s: %s", daemon.driver, container.ID, err)
|
||||
return derr.ErrorCodeRmDriverFS.WithArgs(daemon.driver, container.ID, err)
|
||||
}
|
||||
|
||||
initID := fmt.Sprintf("%s-init", container.ID)
|
||||
if err := daemon.driver.Remove(initID); err != nil {
|
||||
return fmt.Errorf("Driver %s failed to remove init filesystem %s: %s", daemon.driver, initID, err)
|
||||
return derr.ErrorCodeRmInit.WithArgs(daemon.driver, initID, err)
|
||||
}
|
||||
|
||||
if err = os.RemoveAll(container.root); err != nil {
|
||||
return fmt.Errorf("Unable to remove filesystem for %v: %v", container.ID, err)
|
||||
return derr.ErrorCodeRmFS.WithArgs(container.ID, err)
|
||||
}
|
||||
|
||||
if err = daemon.execDriver.Clean(container.ID); err != nil {
|
||||
return fmt.Errorf("Unable to remove execdriver data for %s: %s", container.ID, err)
|
||||
return derr.ErrorCodeRmExecDriver.WithArgs(container.ID, err)
|
||||
}
|
||||
|
||||
selinuxFreeLxcContexts(container.ProcessLabel)
|
||||
@@ -154,9 +156,9 @@ func (daemon *Daemon) VolumeRm(name string) error {
|
||||
}
|
||||
if err := daemon.volumes.Remove(v); err != nil {
|
||||
if err == store.ErrVolumeInUse {
|
||||
return fmt.Errorf("Conflict: %v", err)
|
||||
return derr.ErrorCodeRmVolumeInUse.WithArgs(err)
|
||||
}
|
||||
return fmt.Errorf("Error while removing volume %s: %v", name, err)
|
||||
return derr.ErrorCodeRmVolume.WithArgs(name, err)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
+10
-10
@@ -1,7 +1,6 @@
|
||||
package daemon
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"strings"
|
||||
@@ -10,6 +9,7 @@ import (
|
||||
|
||||
"github.com/Sirupsen/logrus"
|
||||
"github.com/docker/docker/daemon/execdriver"
|
||||
derr "github.com/docker/docker/errors"
|
||||
"github.com/docker/docker/pkg/broadcastwriter"
|
||||
"github.com/docker/docker/pkg/ioutils"
|
||||
"github.com/docker/docker/pkg/pools"
|
||||
@@ -80,7 +80,7 @@ func (ExecConfig *ExecConfig) resize(h, w int) error {
|
||||
select {
|
||||
case <-ExecConfig.waitStart:
|
||||
case <-time.After(time.Second):
|
||||
return fmt.Errorf("Exec %s is not running, so it can not be resized.", ExecConfig.ID)
|
||||
return derr.ErrorCodeExecResize.WithArgs(ExecConfig.ID)
|
||||
}
|
||||
return ExecConfig.ProcessConfig.Terminal.Resize(h, w)
|
||||
}
|
||||
@@ -104,12 +104,12 @@ func (d *Daemon) getExecConfig(name string) (*ExecConfig, error) {
|
||||
if ExecConfig != nil && d.containers.Get(ExecConfig.Container.ID) != nil {
|
||||
|
||||
if !ExecConfig.Container.IsRunning() {
|
||||
return nil, fmt.Errorf("Container %s is not running", ExecConfig.Container.ID)
|
||||
return nil, derr.ErrorCodeContainerNotRunning.WithArgs(ExecConfig.Container.ID)
|
||||
}
|
||||
return ExecConfig, nil
|
||||
}
|
||||
|
||||
return nil, fmt.Errorf("No such exec instance '%s' found in daemon", name)
|
||||
return nil, derr.ErrorCodeNoExecID.WithArgs(name)
|
||||
}
|
||||
|
||||
func (d *Daemon) unregisterExecCommand(ExecConfig *ExecConfig) {
|
||||
@@ -124,10 +124,10 @@ func (d *Daemon) getActiveContainer(name string) (*Container, error) {
|
||||
}
|
||||
|
||||
if !container.IsRunning() {
|
||||
return nil, fmt.Errorf("Container %s is not running", name)
|
||||
return nil, derr.ErrorCodeNotRunning.WithArgs(name)
|
||||
}
|
||||
if container.isPaused() {
|
||||
return nil, fmt.Errorf("Container %s is paused, unpause the container before exec", name)
|
||||
return nil, derr.ErrorCodeExecPaused.WithArgs(name)
|
||||
}
|
||||
return container, nil
|
||||
}
|
||||
@@ -196,7 +196,7 @@ func (d *Daemon) ContainerExecStart(execName string, stdin io.ReadCloser, stdout
|
||||
ExecConfig.Lock()
|
||||
defer ExecConfig.Unlock()
|
||||
if ExecConfig.Running {
|
||||
err = fmt.Errorf("Error: Exec command %s is already running", execName)
|
||||
err = derr.ErrorCodeExecRunning.WithArgs(execName)
|
||||
}
|
||||
ExecConfig.Running = true
|
||||
}()
|
||||
@@ -244,13 +244,13 @@ func (d *Daemon) ContainerExecStart(execName string, stdin io.ReadCloser, stdout
|
||||
|
||||
go func() {
|
||||
if err := container.exec(ExecConfig); err != nil {
|
||||
execErr <- fmt.Errorf("Cannot run exec command %s in container %s: %s", execName, container.ID, err)
|
||||
execErr <- derr.ErrorCodeExecCantRun.WithArgs(execName, container.ID, err)
|
||||
}
|
||||
}()
|
||||
select {
|
||||
case err := <-attachErr:
|
||||
if err != nil {
|
||||
return fmt.Errorf("attach failed with error: %s", err)
|
||||
return derr.ErrorCodeExecAttach.WithArgs(err)
|
||||
}
|
||||
return nil
|
||||
case err := <-execErr:
|
||||
@@ -260,7 +260,7 @@ func (d *Daemon) ContainerExecStart(execName string, stdin io.ReadCloser, stdout
|
||||
|
||||
// Maybe the container stopped while we were trying to exec
|
||||
if !container.IsRunning() {
|
||||
return fmt.Errorf("container stopped while running exec")
|
||||
return derr.ErrorCodeExecContainerStopped
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
+4
-3
@@ -1,8 +1,9 @@
|
||||
package daemon
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"io"
|
||||
|
||||
derr "github.com/docker/docker/errors"
|
||||
)
|
||||
|
||||
// ContainerExport writes the contents of the container to the given
|
||||
@@ -15,13 +16,13 @@ func (daemon *Daemon) ContainerExport(name string, out io.Writer) error {
|
||||
|
||||
data, err := container.export()
|
||||
if err != nil {
|
||||
return fmt.Errorf("%s: %s", name, err)
|
||||
return derr.ErrorCodeExportFailed.WithArgs(name, err)
|
||||
}
|
||||
defer data.Close()
|
||||
|
||||
// Stream the entire contents of the container (basically a volatile snapshot)
|
||||
if _, err := io.Copy(out, data); err != nil {
|
||||
return fmt.Errorf("%s: %s", name, err)
|
||||
return derr.ErrorCodeExportFailed.WithArgs(name, err)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@ import (
|
||||
"strings"
|
||||
|
||||
"github.com/docker/docker/api/types"
|
||||
derr "github.com/docker/docker/errors"
|
||||
"github.com/docker/docker/graph/tags"
|
||||
"github.com/docker/docker/image"
|
||||
"github.com/docker/docker/pkg/parsers"
|
||||
@@ -69,7 +70,7 @@ func (daemon *Daemon) ImageDelete(imageRef string, force, prune bool) ([]types.I
|
||||
// this image would remain "dangling" and since
|
||||
// we really want to avoid that the client must
|
||||
// explicitly force its removal.
|
||||
return nil, fmt.Errorf("conflict: unable to remove repository reference %q (must force) - container %s is using its referenced image %s", imageRef, stringid.TruncateID(container.ID), stringid.TruncateID(img.ID))
|
||||
return nil, derr.ErrorCodeImgDelUsed.WithArgs(imageRef, stringid.TruncateID(container.ID), stringid.TruncateID(img.ID))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -238,7 +239,7 @@ func (daemon *Daemon) imageDeleteHelper(img *image.Image, records *[]types.Image
|
||||
// either running or stopped).
|
||||
parentImg, err := daemon.Graph().Get(img.Parent)
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to get parent image: %v", err)
|
||||
return derr.ErrorCodeImgNoParent.WithArgs(err)
|
||||
}
|
||||
|
||||
// Do not force prunings, but do so quietly (stopping on any encountered
|
||||
|
||||
+2
-1
@@ -8,6 +8,7 @@ import (
|
||||
|
||||
"github.com/Sirupsen/logrus"
|
||||
"github.com/docker/docker/api/types"
|
||||
derr "github.com/docker/docker/errors"
|
||||
"github.com/docker/docker/image"
|
||||
"github.com/docker/docker/pkg/graphdb"
|
||||
"github.com/docker/docker/pkg/nat"
|
||||
@@ -370,7 +371,7 @@ func (daemon *Daemon) Volumes(filter string) ([]*types.Volume, error) {
|
||||
filterUsed := false
|
||||
if i, ok := volFilters["dangling"]; ok {
|
||||
if len(i) > 1 {
|
||||
return nil, fmt.Errorf("Conflict: cannot use more than 1 value for `dangling` filter")
|
||||
return nil, derr.ErrorCodeDanglingOne
|
||||
}
|
||||
|
||||
filterValue := i[0]
|
||||
|
||||
+2
-2
@@ -1,13 +1,13 @@
|
||||
package daemon
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"io"
|
||||
"strconv"
|
||||
"time"
|
||||
|
||||
"github.com/Sirupsen/logrus"
|
||||
"github.com/docker/docker/daemon/logger"
|
||||
derr "github.com/docker/docker/errors"
|
||||
"github.com/docker/docker/pkg/stdcopy"
|
||||
)
|
||||
|
||||
@@ -32,7 +32,7 @@ type ContainerLogsConfig struct {
|
||||
// configured with the given struct.
|
||||
func (daemon *Daemon) ContainerLogs(container *Container, config *ContainerLogsConfig) error {
|
||||
if !(config.UseStdout || config.UseStderr) {
|
||||
return fmt.Errorf("You must choose at least one stream")
|
||||
return derr.ErrorCodeNeedStream
|
||||
}
|
||||
|
||||
outStream := config.OutStream
|
||||
|
||||
+4
-2
@@ -1,6 +1,8 @@
|
||||
package daemon
|
||||
|
||||
import "fmt"
|
||||
import (
|
||||
derr "github.com/docker/docker/errors"
|
||||
)
|
||||
|
||||
// ContainerPause pauses a container
|
||||
func (daemon *Daemon) ContainerPause(name string) error {
|
||||
@@ -10,7 +12,7 @@ func (daemon *Daemon) ContainerPause(name string) error {
|
||||
}
|
||||
|
||||
if err := container.pause(); err != nil {
|
||||
return fmt.Errorf("Cannot pause container %s: %s", name, err)
|
||||
return derr.ErrorCodePauseError.WithArgs(name, err)
|
||||
}
|
||||
|
||||
return nil
|
||||
|
||||
+4
-4
@@ -1,7 +1,7 @@
|
||||
package daemon
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
derr "github.com/docker/docker/errors"
|
||||
)
|
||||
|
||||
// ContainerRename changes the name of a container, using the oldName
|
||||
@@ -9,7 +9,7 @@ import (
|
||||
// reserved.
|
||||
func (daemon *Daemon) ContainerRename(oldName, newName string) error {
|
||||
if oldName == "" || newName == "" {
|
||||
return fmt.Errorf("Neither old nor new names may be empty")
|
||||
return derr.ErrorCodeEmptyRename
|
||||
}
|
||||
|
||||
container, err := daemon.Get(oldName)
|
||||
@@ -22,7 +22,7 @@ func (daemon *Daemon) ContainerRename(oldName, newName string) error {
|
||||
container.Lock()
|
||||
defer container.Unlock()
|
||||
if newName, err = daemon.reserveName(container.ID, newName); err != nil {
|
||||
return fmt.Errorf("Error when allocating new name: %s", err)
|
||||
return derr.ErrorCodeRenameTaken.WithArgs(err)
|
||||
}
|
||||
|
||||
container.Name = newName
|
||||
@@ -35,7 +35,7 @@ func (daemon *Daemon) ContainerRename(oldName, newName string) error {
|
||||
|
||||
if err := daemon.containerGraphDB.Delete(oldName); err != nil {
|
||||
undo()
|
||||
return fmt.Errorf("Failed to delete container %q: %v", oldName, err)
|
||||
return derr.ErrorCodeRenameDelete.WithArgs(oldName, err)
|
||||
}
|
||||
|
||||
if err := container.toDisk(); err != nil {
|
||||
|
||||
+4
-2
@@ -1,6 +1,8 @@
|
||||
package daemon
|
||||
|
||||
import "fmt"
|
||||
import (
|
||||
derr "github.com/docker/docker/errors"
|
||||
)
|
||||
|
||||
// ContainerRestart stops and starts a container. It attempts to
|
||||
// gracefully stop the container within the given timeout, forcefully
|
||||
@@ -14,7 +16,7 @@ func (daemon *Daemon) ContainerRestart(name string, seconds int) error {
|
||||
return err
|
||||
}
|
||||
if err := container.Restart(seconds); err != nil {
|
||||
return fmt.Errorf("Cannot restart container %s: %s\n", name, err)
|
||||
return derr.ErrorCodeCantRestart.WithArgs(name, err)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
+343
-5
@@ -24,6 +24,7 @@ var (
|
||||
ErrorCodeUnregisteredContainer = errcode.Register(errGroup, errcode.ErrorDescriptor{
|
||||
Value: "UNREGISTEREDCONTAINER",
|
||||
Message: "Can't load storage driver for unregistered container %s",
|
||||
Description: "An attempt was made to load the storage driver for a container that is not registered with the daemon",
|
||||
HTTPStatusCode: http.StatusInternalServerError,
|
||||
})
|
||||
|
||||
@@ -32,6 +33,7 @@ var (
|
||||
ErrorCodeContainerBeingRemoved = errcode.Register(errGroup, errcode.ErrorDescriptor{
|
||||
Value: "CONTAINERBEINGREMOVED",
|
||||
Message: "Container is marked for removal and cannot be started.",
|
||||
Description: "An attempt was made to start a container that is in the process of being deleted",
|
||||
HTTPStatusCode: http.StatusInternalServerError,
|
||||
})
|
||||
|
||||
@@ -40,6 +42,7 @@ var (
|
||||
ErrorCodeUnpauseContainer = errcode.Register(errGroup, errcode.ErrorDescriptor{
|
||||
Value: "UNPAUSECONTAINER",
|
||||
Message: "Container %s is paused. Unpause the container before stopping",
|
||||
Description: "The specified container is paused, before it can be stopped it must be unpaused",
|
||||
HTTPStatusCode: http.StatusInternalServerError,
|
||||
})
|
||||
|
||||
@@ -48,6 +51,7 @@ var (
|
||||
ErrorCodeAlreadyPaused = errcode.Register(errGroup, errcode.ErrorDescriptor{
|
||||
Value: "ALREADYPAUSED",
|
||||
Message: "Container %s is already paused",
|
||||
Description: "The specified container is already in the paused state",
|
||||
HTTPStatusCode: http.StatusInternalServerError,
|
||||
})
|
||||
|
||||
@@ -56,6 +60,7 @@ var (
|
||||
ErrorCodeNotPaused = errcode.Register(errGroup, errcode.ErrorDescriptor{
|
||||
Value: "NOTPAUSED",
|
||||
Message: "Container %s is not paused",
|
||||
Description: "The specified container can not be unpaused because it is not in a paused state",
|
||||
HTTPStatusCode: http.StatusInternalServerError,
|
||||
})
|
||||
|
||||
@@ -64,6 +69,7 @@ var (
|
||||
ErrorCodeImageUnregContainer = errcode.Register(errGroup, errcode.ErrorDescriptor{
|
||||
Value: "IMAGEUNREGCONTAINER",
|
||||
Message: "Can't get image of unregistered container",
|
||||
Description: "An attempt to retrieve the image of a container was made but the container is not registered",
|
||||
HTTPStatusCode: http.StatusInternalServerError,
|
||||
})
|
||||
|
||||
@@ -71,6 +77,7 @@ var (
|
||||
ErrorCodeEmptyID = errcode.Register(errGroup, errcode.ErrorDescriptor{
|
||||
Value: "EMPTYID",
|
||||
Message: "Invalid empty id",
|
||||
Description: "An attempt was made to register a container but the container's ID can not be an empty string",
|
||||
HTTPStatusCode: http.StatusInternalServerError,
|
||||
})
|
||||
|
||||
@@ -79,6 +86,7 @@ var (
|
||||
ErrorCodeLoggingFactory = errcode.Register(errGroup, errcode.ErrorDescriptor{
|
||||
Value: "LOGGINGFACTORY",
|
||||
Message: "Failed to get logging factory: %v",
|
||||
Description: "An attempt was made to register a container but the container's ID can not be an empty string",
|
||||
HTTPStatusCode: http.StatusInternalServerError,
|
||||
})
|
||||
|
||||
@@ -87,6 +95,7 @@ var (
|
||||
ErrorCodeInitLogger = errcode.Register(errGroup, errcode.ErrorDescriptor{
|
||||
Value: "INITLOGGER",
|
||||
Message: "Failed to initialize logging driver: %v",
|
||||
Description: "An error occurred while trying to initialize the logging driver",
|
||||
HTTPStatusCode: http.StatusInternalServerError,
|
||||
})
|
||||
|
||||
@@ -95,6 +104,7 @@ var (
|
||||
ErrorCodeNotRunning = errcode.Register(errGroup, errcode.ErrorDescriptor{
|
||||
Value: "NOTRUNNING",
|
||||
Message: "Container %s is not running",
|
||||
Description: "The specified action can not be taken due to the container not being in a running state",
|
||||
HTTPStatusCode: http.StatusInternalServerError,
|
||||
})
|
||||
|
||||
@@ -103,6 +113,7 @@ var (
|
||||
ErrorCodeLinkNotRunning = errcode.Register(errGroup, errcode.ErrorDescriptor{
|
||||
Value: "LINKNOTRUNNING",
|
||||
Message: "Cannot link to a non running container: %s AS %s",
|
||||
Description: "An attempt was made to link to a container but the container is not in a running state",
|
||||
HTTPStatusCode: http.StatusInternalServerError,
|
||||
})
|
||||
|
||||
@@ -112,6 +123,7 @@ var (
|
||||
ErrorCodeDeviceInfo = errcode.Register(errGroup, errcode.ErrorDescriptor{
|
||||
Value: "DEVICEINFO",
|
||||
Message: "error gathering device information while adding custom device %q: %s",
|
||||
Description: "There was an error while trying to retrieve the information about a custom device",
|
||||
HTTPStatusCode: http.StatusInternalServerError,
|
||||
})
|
||||
|
||||
@@ -120,6 +132,7 @@ var (
|
||||
ErrorCodeEmptyEndpoint = errcode.Register(errGroup, errcode.ErrorDescriptor{
|
||||
Value: "EMPTYENDPOINT",
|
||||
Message: "invalid endpoint while building port map info",
|
||||
Description: "The specified endpoint for the port mapping is empty",
|
||||
HTTPStatusCode: http.StatusInternalServerError,
|
||||
})
|
||||
|
||||
@@ -128,6 +141,7 @@ var (
|
||||
ErrorCodeEmptyNetwork = errcode.Register(errGroup, errcode.ErrorDescriptor{
|
||||
Value: "EMPTYNETWORK",
|
||||
Message: "invalid networksettings while building port map info",
|
||||
Description: "The specified endpoint for the port mapping is empty",
|
||||
HTTPStatusCode: http.StatusInternalServerError,
|
||||
})
|
||||
|
||||
@@ -136,6 +150,7 @@ var (
|
||||
ErrorCodeParsingPort = errcode.Register(errGroup, errcode.ErrorDescriptor{
|
||||
Value: "PARSINGPORT",
|
||||
Message: "Error parsing Port value(%v):%v",
|
||||
Description: "There was an error while trying to parse the specified 'port' value",
|
||||
HTTPStatusCode: http.StatusInternalServerError,
|
||||
})
|
||||
|
||||
@@ -144,6 +159,7 @@ var (
|
||||
ErrorCodeNoSandbox = errcode.Register(errGroup, errcode.ErrorDescriptor{
|
||||
Value: "NOSANDBOX",
|
||||
Message: "error locating sandbox id %s: %v",
|
||||
Description: "There was an error trying to located the specified networking sandbox",
|
||||
HTTPStatusCode: http.StatusInternalServerError,
|
||||
})
|
||||
|
||||
@@ -152,6 +168,7 @@ var (
|
||||
ErrorCodeNetworkUpdate = errcode.Register(errGroup, errcode.ErrorDescriptor{
|
||||
Value: "NETWORKUPDATE",
|
||||
Message: "Update network failed: %v",
|
||||
Description: "There was an error trying to update the configuration information of the specified network sandbox",
|
||||
HTTPStatusCode: http.StatusInternalServerError,
|
||||
})
|
||||
|
||||
@@ -160,22 +177,25 @@ var (
|
||||
ErrorCodeNetworkRefresh = errcode.Register(errGroup, errcode.ErrorDescriptor{
|
||||
Value: "NETWORKREFRESH",
|
||||
Message: "Update network failed: Failure in refresh sandbox %s: %v",
|
||||
Description: "There was an error trying to refresh the configuration information of the specified network sandbox",
|
||||
HTTPStatusCode: http.StatusInternalServerError,
|
||||
})
|
||||
|
||||
// ErrorCodeHostPort is generated when there was an error while trying
|
||||
// to parse a "host/por" string.
|
||||
// to parse a "host/port" string.
|
||||
ErrorCodeHostPort = errcode.Register(errGroup, errcode.ErrorDescriptor{
|
||||
Value: "HOSTPORT",
|
||||
Message: "Error parsing HostPort value(%s):%v",
|
||||
Description: "There was an error trying to parse the specified 'HostPort' value",
|
||||
HTTPStatusCode: http.StatusInternalServerError,
|
||||
})
|
||||
|
||||
// ErrorCodeNetworkConflict is generated when we try to public a service
|
||||
// ErrorCodeNetworkConflict is generated when we try to publish a service
|
||||
// in network mode.
|
||||
ErrorCodeNetworkConflict = errcode.Register(errGroup, errcode.ErrorDescriptor{
|
||||
Value: "NETWORKCONFLICT",
|
||||
Message: "conflicting options: publishing a service and network mode",
|
||||
Description: "It is not possible to publish a service when it is in network mode",
|
||||
HTTPStatusCode: http.StatusConflict,
|
||||
})
|
||||
|
||||
@@ -184,14 +204,16 @@ var (
|
||||
ErrorCodeJoinInfo = errcode.Register(errGroup, errcode.ErrorDescriptor{
|
||||
Value: "JOININFO",
|
||||
Message: "Updating join info failed: %v",
|
||||
Description: "There was an error during an attempt update a container's join information",
|
||||
HTTPStatusCode: http.StatusInternalServerError,
|
||||
})
|
||||
|
||||
// ErrorCodeIPCRunning is generated when we try to join a container's
|
||||
// IPC but its running.
|
||||
// IPC but its not running.
|
||||
ErrorCodeIPCRunning = errcode.Register(errGroup, errcode.ErrorDescriptor{
|
||||
Value: "IPCRUNNING",
|
||||
Message: "cannot join IPC of a non running container: %s",
|
||||
Description: "An attempt was made to join the IPC of a container, but the container is not running",
|
||||
HTTPStatusCode: http.StatusInternalServerError,
|
||||
})
|
||||
|
||||
@@ -200,6 +222,7 @@ var (
|
||||
ErrorCodeNotADir = errcode.Register(errGroup, errcode.ErrorDescriptor{
|
||||
Value: "NOTADIR",
|
||||
Message: "Cannot mkdir: %s is not a directory",
|
||||
Description: "An attempt was made create a directory, but the location in which it is being created is not a directory",
|
||||
HTTPStatusCode: http.StatusInternalServerError,
|
||||
})
|
||||
|
||||
@@ -208,6 +231,7 @@ var (
|
||||
ErrorCodeParseContainer = errcode.Register(errGroup, errcode.ErrorDescriptor{
|
||||
Value: "PARSECONTAINER",
|
||||
Message: "no container specified to join network",
|
||||
Description: "The specified reference to a container is missing a ':' as a separator between 'container' and 'name'/'id'",
|
||||
HTTPStatusCode: http.StatusInternalServerError,
|
||||
})
|
||||
|
||||
@@ -215,6 +239,7 @@ var (
|
||||
ErrorCodeJoinSelf = errcode.Register(errGroup, errcode.ErrorDescriptor{
|
||||
Value: "JOINSELF",
|
||||
Message: "cannot join own network",
|
||||
Description: "An attempt was made to have a container join its own network",
|
||||
HTTPStatusCode: http.StatusInternalServerError,
|
||||
})
|
||||
|
||||
@@ -222,6 +247,7 @@ var (
|
||||
ErrorCodeJoinRunning = errcode.Register(errGroup, errcode.ErrorDescriptor{
|
||||
Value: "JOINRUNNING",
|
||||
Message: "cannot join network of a non running container: %s",
|
||||
Description: "An attempt to join the network of a container, but that container isn't running",
|
||||
HTTPStatusCode: http.StatusInternalServerError,
|
||||
})
|
||||
|
||||
@@ -230,6 +256,7 @@ var (
|
||||
ErrorCodeModeNotContainer = errcode.Register(errGroup, errcode.ErrorDescriptor{
|
||||
Value: "MODENOTCONTAINER",
|
||||
Message: "network mode not set to container",
|
||||
Description: "An attempt was made to connect to a container's network but the mode wasn't set to 'container'",
|
||||
HTTPStatusCode: http.StatusInternalServerError,
|
||||
})
|
||||
|
||||
@@ -238,6 +265,7 @@ var (
|
||||
ErrorCodeRemovingVolume = errcode.Register(errGroup, errcode.ErrorDescriptor{
|
||||
Value: "REMOVINGVOLUME",
|
||||
Message: "Error removing volumes:\n%v",
|
||||
Description: "There was an error while trying to remove the mount point (volume) of a container",
|
||||
HTTPStatusCode: http.StatusInternalServerError,
|
||||
})
|
||||
|
||||
@@ -246,6 +274,7 @@ var (
|
||||
ErrorCodeInvalidNetworkMode = errcode.Register(errGroup, errcode.ErrorDescriptor{
|
||||
Value: "INVALIDNETWORKMODE",
|
||||
Message: "invalid network mode: %s",
|
||||
Description: "The specified networking mode is not valid",
|
||||
HTTPStatusCode: http.StatusInternalServerError,
|
||||
})
|
||||
|
||||
@@ -254,6 +283,7 @@ var (
|
||||
ErrorCodeGetGraph = errcode.Register(errGroup, errcode.ErrorDescriptor{
|
||||
Value: "GETGRAPH",
|
||||
Message: "Failed to graph.Get on ImageID %s - %s",
|
||||
Description: "There was an error trying to retrieve the image for the specified image ID",
|
||||
HTTPStatusCode: http.StatusInternalServerError,
|
||||
})
|
||||
|
||||
@@ -262,6 +292,7 @@ var (
|
||||
ErrorCodeGetLayer = errcode.Register(errGroup, errcode.ErrorDescriptor{
|
||||
Value: "GETLAYER",
|
||||
Message: "Failed to get layer path from graphdriver %s for ImageID %s - %s",
|
||||
Description: "There was an error trying to retrieve the layer of the specified image",
|
||||
HTTPStatusCode: http.StatusInternalServerError,
|
||||
})
|
||||
|
||||
@@ -270,6 +301,7 @@ var (
|
||||
ErrorCodePutLayer = errcode.Register(errGroup, errcode.ErrorDescriptor{
|
||||
Value: "PUTLAYER",
|
||||
Message: "Failed to put layer path from graphdriver %s for ImageID %s - %s",
|
||||
Description: "There was an error trying to store a layer for the specified image",
|
||||
HTTPStatusCode: http.StatusInternalServerError,
|
||||
})
|
||||
|
||||
@@ -278,6 +310,7 @@ var (
|
||||
ErrorCodeGetLayerMetadata = errcode.Register(errGroup, errcode.ErrorDescriptor{
|
||||
Value: "GETLAYERMETADATA",
|
||||
Message: "Failed to get layer metadata - %s",
|
||||
Description: "There was an error trying to retrieve the metadata of a layer for the specified image",
|
||||
HTTPStatusCode: http.StatusInternalServerError,
|
||||
})
|
||||
|
||||
@@ -286,6 +319,7 @@ var (
|
||||
ErrorCodeEmptyConfig = errcode.Register(errGroup, errcode.ErrorDescriptor{
|
||||
Value: "EMPTYCONFIG",
|
||||
Message: "Config cannot be empty in order to create a container",
|
||||
Description: "While trying to create a container, the specified configuration information was empty",
|
||||
HTTPStatusCode: http.StatusInternalServerError,
|
||||
})
|
||||
|
||||
@@ -294,6 +328,7 @@ var (
|
||||
ErrorCodeNoSuchImageHash = errcode.Register(errGroup, errcode.ErrorDescriptor{
|
||||
Value: "NOSUCHIMAGEHASH",
|
||||
Message: "No such image: %s",
|
||||
Description: "An attempt was made to find an image by its hash, but the lookup failed",
|
||||
HTTPStatusCode: http.StatusNotFound,
|
||||
})
|
||||
|
||||
@@ -302,6 +337,7 @@ var (
|
||||
ErrorCodeNoSuchImageTag = errcode.Register(errGroup, errcode.ErrorDescriptor{
|
||||
Value: "NOSUCHIMAGETAG",
|
||||
Message: "No such image: %s:%s",
|
||||
Description: "An attempt was made to find an image by its name/tag, but the lookup failed",
|
||||
HTTPStatusCode: http.StatusNotFound,
|
||||
})
|
||||
|
||||
@@ -310,14 +346,16 @@ var (
|
||||
ErrorCodeMountOverFile = errcode.Register(errGroup, errcode.ErrorDescriptor{
|
||||
Value: "MOUNTOVERFILE",
|
||||
Message: "cannot mount volume over existing file, file exists %s",
|
||||
Description: "An attempt was made to mount a volume at the same location as a pre-existing file",
|
||||
HTTPStatusCode: http.StatusInternalServerError,
|
||||
})
|
||||
|
||||
// ErrorCodeMountSetup is generated when we can't define a mount point
|
||||
// due to the source and destination are defined.
|
||||
// due to the source and destination being undefined.
|
||||
ErrorCodeMountSetup = errcode.Register(errGroup, errcode.ErrorDescriptor{
|
||||
Value: "MOUNTSETUP",
|
||||
Message: "Unable to setup mount point, neither source nor volume defined",
|
||||
Description: "An attempt was made to setup a mount point, but the source and destination are undefined",
|
||||
HTTPStatusCode: http.StatusInternalServerError,
|
||||
})
|
||||
|
||||
@@ -326,6 +364,7 @@ var (
|
||||
ErrorCodeVolumeInvalidMode = errcode.Register(errGroup, errcode.ErrorDescriptor{
|
||||
Value: "VOLUMEINVALIDMODE",
|
||||
Message: "invalid mode for volumes-from: %s",
|
||||
Description: "An invalid 'mode' was specified in the mount request",
|
||||
HTTPStatusCode: http.StatusInternalServerError,
|
||||
})
|
||||
|
||||
@@ -334,6 +373,7 @@ var (
|
||||
ErrorCodeVolumeInvalid = errcode.Register(errGroup, errcode.ErrorDescriptor{
|
||||
Value: "VOLUMEINVALID",
|
||||
Message: "Invalid volume specification: %s",
|
||||
Description: "An invalid 'volume' was specified in the mount request",
|
||||
HTTPStatusCode: http.StatusInternalServerError,
|
||||
})
|
||||
|
||||
@@ -341,6 +381,7 @@ var (
|
||||
ErrorCodeVolumeAbs = errcode.Register(errGroup, errcode.ErrorDescriptor{
|
||||
Value: "VOLUMEABS",
|
||||
Message: "Invalid volume destination path: %s mount path must be absolute.",
|
||||
Description: "An invalid 'destination' path was specified in the mount request, it must be an absolute path",
|
||||
HTTPStatusCode: http.StatusInternalServerError,
|
||||
})
|
||||
|
||||
@@ -348,6 +389,7 @@ var (
|
||||
ErrorCodeVolumeFromBlank = errcode.Register(errGroup, errcode.ErrorDescriptor{
|
||||
Value: "VOLUMEFROMBLANK",
|
||||
Message: "malformed volumes-from specification: %s",
|
||||
Description: "An invalid 'destination' path was specified in the mount request, it must not be blank",
|
||||
HTTPStatusCode: http.StatusInternalServerError,
|
||||
})
|
||||
|
||||
@@ -356,6 +398,7 @@ var (
|
||||
ErrorCodeVolumeMode = errcode.Register(errGroup, errcode.ErrorDescriptor{
|
||||
Value: "VOLUMEMODE",
|
||||
Message: "invalid mode for volumes-from: %s",
|
||||
Description: "An invalid 'mode' path was specified in the mount request",
|
||||
HTTPStatusCode: http.StatusInternalServerError,
|
||||
})
|
||||
|
||||
@@ -364,6 +407,7 @@ var (
|
||||
ErrorCodeVolumeDup = errcode.Register(errGroup, errcode.ErrorDescriptor{
|
||||
Value: "VOLUMEDUP",
|
||||
Message: "Duplicate bind mount %s",
|
||||
Description: "An attempt was made to mount a volume but the specified destination location is already used in a previous mount",
|
||||
HTTPStatusCode: http.StatusInternalServerError,
|
||||
})
|
||||
|
||||
@@ -372,6 +416,7 @@ var (
|
||||
ErrorCodeCantUnpause = errcode.Register(errGroup, errcode.ErrorDescriptor{
|
||||
Value: "CANTUNPAUSE",
|
||||
Message: "Cannot unpause container %s: %s",
|
||||
Description: "An error occurred while trying to unpause the specified container",
|
||||
HTTPStatusCode: http.StatusInternalServerError,
|
||||
})
|
||||
|
||||
@@ -379,6 +424,7 @@ var (
|
||||
ErrorCodePSError = errcode.Register(errGroup, errcode.ErrorDescriptor{
|
||||
Value: "PSError",
|
||||
Message: "Error running ps: %s",
|
||||
Description: "There was an error trying to run the 'ps' command in the specified container",
|
||||
HTTPStatusCode: http.StatusInternalServerError,
|
||||
})
|
||||
|
||||
@@ -387,6 +433,7 @@ var (
|
||||
ErrorCodeNoPID = errcode.Register(errGroup, errcode.ErrorDescriptor{
|
||||
Value: "NOPID",
|
||||
Message: "Couldn't find PID field in ps output",
|
||||
Description: "There was no 'PID' field in the output of the 'ps' command that was executed",
|
||||
HTTPStatusCode: http.StatusInternalServerError,
|
||||
})
|
||||
|
||||
@@ -394,6 +441,7 @@ var (
|
||||
ErrorCodeBadPID = errcode.Register(errGroup, errcode.ErrorDescriptor{
|
||||
Value: "BADPID",
|
||||
Message: "Unexpected pid '%s': %s",
|
||||
Description: "While trying to parse the output of the 'ps' command, the 'PID' field was not an integer",
|
||||
HTTPStatusCode: http.StatusInternalServerError,
|
||||
})
|
||||
|
||||
@@ -402,6 +450,7 @@ var (
|
||||
ErrorCodeNoTop = errcode.Register(errGroup, errcode.ErrorDescriptor{
|
||||
Value: "NOTOP",
|
||||
Message: "Top is not supported on Windows",
|
||||
Description: "The 'top' command is not supported on Windows",
|
||||
HTTPStatusCode: http.StatusInternalServerError,
|
||||
})
|
||||
|
||||
@@ -410,6 +459,7 @@ var (
|
||||
ErrorCodeStopped = errcode.Register(errGroup, errcode.ErrorDescriptor{
|
||||
Value: "STOPPED",
|
||||
Message: "Container already stopped",
|
||||
Description: "An attempt was made to stop a container, but the container is already stopped",
|
||||
HTTPStatusCode: http.StatusNotModified,
|
||||
})
|
||||
|
||||
@@ -418,14 +468,16 @@ var (
|
||||
ErrorCodeCantStop = errcode.Register(errGroup, errcode.ErrorDescriptor{
|
||||
Value: "CANTSTOP",
|
||||
Message: "Cannot stop container %s: %s\n",
|
||||
Description: "An error occurred while tring to stop the specified container",
|
||||
HTTPStatusCode: http.StatusInternalServerError,
|
||||
})
|
||||
|
||||
// ErrorCodeBadCPUFields is generated the number of CPU fields is
|
||||
// ErrorCodeBadCPUFields is generated when the number of CPU fields is
|
||||
// less than 8.
|
||||
ErrorCodeBadCPUFields = errcode.Register(errGroup, errcode.ErrorDescriptor{
|
||||
Value: "BADCPUFIELDS",
|
||||
Message: "invalid number of cpu fields",
|
||||
Description: "While reading the '/proc/stat' file, the number of 'cpu' fields is less than 8",
|
||||
HTTPStatusCode: http.StatusInternalServerError,
|
||||
})
|
||||
|
||||
@@ -433,6 +485,7 @@ var (
|
||||
ErrorCodeBadCPUInt = errcode.Register(errGroup, errcode.ErrorDescriptor{
|
||||
Value: "BADCPUINT",
|
||||
Message: "Unable to convert value %s to int: %s",
|
||||
Description: "While reading the '/proc/stat' file, the 'CPU' field could not be parsed as an integer",
|
||||
HTTPStatusCode: http.StatusInternalServerError,
|
||||
})
|
||||
|
||||
@@ -441,6 +494,7 @@ var (
|
||||
ErrorCodeBadStatFormat = errcode.Register(errGroup, errcode.ErrorDescriptor{
|
||||
Value: "BADSTATFORMAT",
|
||||
Message: "invalid stat format",
|
||||
Description: "There was an error trying to parse the '/proc/stat' file",
|
||||
HTTPStatusCode: http.StatusInternalServerError,
|
||||
})
|
||||
|
||||
@@ -448,6 +502,7 @@ var (
|
||||
ErrorCodeTimedOut = errcode.Register(errGroup, errcode.ErrorDescriptor{
|
||||
Value: "TIMEDOUT",
|
||||
Message: "Timed out: %v",
|
||||
Description: "A timer expired",
|
||||
HTTPStatusCode: http.StatusInternalServerError,
|
||||
})
|
||||
|
||||
@@ -456,6 +511,7 @@ var (
|
||||
ErrorCodeAlreadyRemoving = errcode.Register(errGroup, errcode.ErrorDescriptor{
|
||||
Value: "ALREADYREMOVING",
|
||||
Message: "Status is already RemovalInProgress",
|
||||
Description: "An attempt to remove a container was made, but the container is already in the process of being removed",
|
||||
HTTPStatusCode: http.StatusInternalServerError,
|
||||
})
|
||||
|
||||
@@ -463,6 +519,7 @@ var (
|
||||
ErrorCodeStartPaused = errcode.Register(errGroup, errcode.ErrorDescriptor{
|
||||
Value: "STARTPAUSED",
|
||||
Message: "Cannot start a paused container, try unpause instead.",
|
||||
Description: "An attempt to start a container was made, but the container is paused. Unpause it first",
|
||||
HTTPStatusCode: http.StatusInternalServerError,
|
||||
})
|
||||
|
||||
@@ -471,6 +528,7 @@ var (
|
||||
ErrorCodeAlreadyStarted = errcode.Register(errGroup, errcode.ErrorDescriptor{
|
||||
Value: "ALREADYSTARTED",
|
||||
Message: "Container already started",
|
||||
Description: "An attempt to start a container was made, but the container is already started",
|
||||
HTTPStatusCode: http.StatusNotModified,
|
||||
})
|
||||
|
||||
@@ -479,6 +537,7 @@ var (
|
||||
ErrorCodeHostConfigStart = errcode.Register(errGroup, errcode.ErrorDescriptor{
|
||||
Value: "HOSTCONFIGSTART",
|
||||
Message: "Supplying a hostconfig on start is not supported. It should be supplied on create",
|
||||
Description: "The 'start' command does not accept 'HostConfig' data, try using the 'create' command instead",
|
||||
HTTPStatusCode: http.StatusInternalServerError,
|
||||
})
|
||||
|
||||
@@ -487,6 +546,285 @@ var (
|
||||
ErrorCodeCantStart = errcode.Register(errGroup, errcode.ErrorDescriptor{
|
||||
Value: "CANTSTART",
|
||||
Message: "Cannot start container %s: %s",
|
||||
Description: "There was an error while trying to start a container",
|
||||
HTTPStatusCode: http.StatusInternalServerError,
|
||||
})
|
||||
|
||||
// ErrorCodeCantRestart is generated when an error occurred while
|
||||
// trying to restart a container.
|
||||
ErrorCodeCantRestart = errcode.Register(errGroup, errcode.ErrorDescriptor{
|
||||
Value: "CANTRESTART",
|
||||
Message: "Cannot restart container %s: %s",
|
||||
Description: "There was an error while trying to restart a container",
|
||||
HTTPStatusCode: http.StatusInternalServerError,
|
||||
})
|
||||
|
||||
// ErrorCodeEmptyRename is generated when one of the names on a
|
||||
// rename is empty.
|
||||
ErrorCodeEmptyRename = errcode.Register(errGroup, errcode.ErrorDescriptor{
|
||||
Value: "EMPTYRENAME",
|
||||
Message: "Neither old nor new names may be empty",
|
||||
Description: "An attempt was made to rename a container but either the old or new names were blank",
|
||||
HTTPStatusCode: http.StatusInternalServerError,
|
||||
})
|
||||
|
||||
// ErrorCodeRenameTaken is generated when we try to rename but the
|
||||
// new name isn't available.
|
||||
ErrorCodeRenameTaken = errcode.Register(errGroup, errcode.ErrorDescriptor{
|
||||
Value: "RENAMETAKEN",
|
||||
Message: "Error when allocating new name: %s",
|
||||
Description: "The new name specified on the 'rename' command is already being used",
|
||||
HTTPStatusCode: http.StatusInternalServerError,
|
||||
})
|
||||
|
||||
// ErrorCodeRenameDelete is generated when we try to rename but
|
||||
// failed trying to delete the old container.
|
||||
ErrorCodeRenameDelete = errcode.Register(errGroup, errcode.ErrorDescriptor{
|
||||
Value: "RENAMEDELETE",
|
||||
Message: "Failed to delete container %q: %v",
|
||||
Description: "There was an error trying to delete the specified container",
|
||||
HTTPStatusCode: http.StatusInternalServerError,
|
||||
})
|
||||
|
||||
// ErrorCodePauseError is generated when we try to pause a container
|
||||
// but failed.
|
||||
ErrorCodePauseError = errcode.Register(errGroup, errcode.ErrorDescriptor{
|
||||
Value: "PAUSEERROR",
|
||||
Message: "Cannot pause container %s: %s",
|
||||
Description: "There was an error trying to pause the specified container",
|
||||
HTTPStatusCode: http.StatusInternalServerError,
|
||||
})
|
||||
|
||||
// ErrorCodeNeedStream is generated when we try to stream a container's
|
||||
// logs but no output stream was specified.
|
||||
ErrorCodeNeedStream = errcode.Register(errGroup, errcode.ErrorDescriptor{
|
||||
Value: "NEEDSTREAM",
|
||||
Message: "You must choose at least one stream",
|
||||
Description: "While trying to stream a container's logs, no output stream was specified",
|
||||
HTTPStatusCode: http.StatusInternalServerError,
|
||||
})
|
||||
|
||||
// ErrorCodeDanglingOne is generated when we try to specify more than one
|
||||
// 'dangling' specifier.
|
||||
ErrorCodeDanglingOne = errcode.Register(errGroup, errcode.ErrorDescriptor{
|
||||
Value: "DANLGINGONE",
|
||||
Message: "Conflict: cannot use more than 1 value for `dangling` filter",
|
||||
Description: "The specified 'dangling' filter may not have more than one value",
|
||||
HTTPStatusCode: http.StatusConflict,
|
||||
})
|
||||
|
||||
// ErrorCodeImgDelUsed is generated when we try to delete an image
|
||||
// but it is being used.
|
||||
ErrorCodeImgDelUsed = errcode.Register(errGroup, errcode.ErrorDescriptor{
|
||||
Value: "IMGDELUSED",
|
||||
Message: "conflict: unable to remove repository reference %q (must force) - container %s is using its referenced image %s",
|
||||
Description: "An attempt was made to delete an image but it is currently being used",
|
||||
HTTPStatusCode: http.StatusConflict,
|
||||
})
|
||||
|
||||
// ErrorCodeImgNoParent is generated when we try to find an image's
|
||||
// parent but its not in the graph.
|
||||
ErrorCodeImgNoParent = errcode.Register(errGroup, errcode.ErrorDescriptor{
|
||||
Value: "IMGNOPARENT",
|
||||
Message: "unable to get parent image: %v",
|
||||
Description: "There was an error trying to find an image's parent, it was not in the graph",
|
||||
HTTPStatusCode: http.StatusInternalServerError,
|
||||
})
|
||||
|
||||
// ErrorCodeExportFailed is generated when an export fails.
|
||||
ErrorCodeExportFailed = errcode.Register(errGroup, errcode.ErrorDescriptor{
|
||||
Value: "EXPORTFAILED",
|
||||
Message: "%s: %s",
|
||||
Description: "There was an error during an export operation",
|
||||
HTTPStatusCode: http.StatusInternalServerError,
|
||||
})
|
||||
|
||||
// ErrorCodeExecResize is generated when we try to resize an exec
|
||||
// but its not running.
|
||||
ErrorCodeExecResize = errcode.Register(errGroup, errcode.ErrorDescriptor{
|
||||
Value: "EXECRESIZE",
|
||||
Message: "Exec %s is not running, so it can not be resized.",
|
||||
Description: "An attempt was made to resize an 'exec', but the 'exec' is not running",
|
||||
HTTPStatusCode: http.StatusInternalServerError,
|
||||
})
|
||||
|
||||
// ErrorCodeContainerNotRunning is generated when we try to get the info
|
||||
// on an exec but the container is not running.
|
||||
ErrorCodeContainerNotRunning = errcode.Register(errGroup, errcode.ErrorDescriptor{
|
||||
Value: "CONTAINERNOTRUNNING",
|
||||
Message: "Container %s is not running: %s",
|
||||
Description: "An attempt was made to retrieve the information about an 'exec' but the container is not running",
|
||||
HTTPStatusCode: http.StatusInternalServerError,
|
||||
})
|
||||
|
||||
// ErrorCodeNoExecID is generated when we try to get the info
|
||||
// on an exec but it can't be found.
|
||||
ErrorCodeNoExecID = errcode.Register(errGroup, errcode.ErrorDescriptor{
|
||||
Value: "NOEXECID",
|
||||
Message: "No such exec instance '%s' found in daemon",
|
||||
Description: "The specified 'exec' instance could not be found",
|
||||
HTTPStatusCode: http.StatusNotFound,
|
||||
})
|
||||
|
||||
// ErrorCodeExecPaused is generated when we try to start an exec
|
||||
// but the container is paused.
|
||||
ErrorCodeExecPaused = errcode.Register(errGroup, errcode.ErrorDescriptor{
|
||||
Value: "EXECPAUSED",
|
||||
Message: "Container %s is paused, unpause the container before exec",
|
||||
Description: "An attempt to start an 'exec' was made, but the owning container is paused",
|
||||
HTTPStatusCode: http.StatusInternalServerError,
|
||||
})
|
||||
|
||||
// ErrorCodeExecRunning is generated when we try to start an exec
|
||||
// but its already running.
|
||||
ErrorCodeExecRunning = errcode.Register(errGroup, errcode.ErrorDescriptor{
|
||||
Value: "EXECRUNNING",
|
||||
Message: "Error: Exec command %s is already running",
|
||||
Description: "An attempt to start an 'exec' was made, but 'exec' is already running",
|
||||
HTTPStatusCode: http.StatusInternalServerError,
|
||||
})
|
||||
|
||||
// ErrorCodeExecCantRun is generated when we try to start an exec
|
||||
// but it failed for some reason.
|
||||
ErrorCodeExecCantRun = errcode.Register(errGroup, errcode.ErrorDescriptor{
|
||||
Value: "EXECCANTRUN",
|
||||
Message: "Cannot run exec command %s in container %s: %s",
|
||||
Description: "An attempt to start an 'exec' was made, but an error occurred",
|
||||
HTTPStatusCode: http.StatusInternalServerError,
|
||||
})
|
||||
|
||||
// ErrorCodeExecAttach is generated when we try to attach to an exec
|
||||
// but failed.
|
||||
ErrorCodeExecAttach = errcode.Register(errGroup, errcode.ErrorDescriptor{
|
||||
Value: "EXECATTACH",
|
||||
Message: "attach failed with error: %s",
|
||||
Description: "There was an error while trying to attach to an 'exec'",
|
||||
HTTPStatusCode: http.StatusInternalServerError,
|
||||
})
|
||||
|
||||
// ErrorCodeExecContainerStopped is generated when we try to start
|
||||
// an exec but then the container stopped.
|
||||
ErrorCodeExecContainerStopped = errcode.Register(errGroup, errcode.ErrorDescriptor{
|
||||
Value: "EXECCONTAINERSTOPPED",
|
||||
Message: "container stopped while running exec",
|
||||
Description: "An attempt was made to start an 'exec' but the owning container is in the 'stopped' state",
|
||||
HTTPStatusCode: http.StatusInternalServerError,
|
||||
})
|
||||
|
||||
// ErrorCodeDefaultName is generated when we try to delete the
|
||||
// default name of a container.
|
||||
ErrorCodeDefaultName = errcode.Register(errGroup, errcode.ErrorDescriptor{
|
||||
Value: "DEFAULTNAME",
|
||||
Message: "Conflict, cannot remove the default name of the container",
|
||||
Description: "An attempt to delete the default name of a container was made, but that is not allowed",
|
||||
HTTPStatusCode: http.StatusConflict,
|
||||
})
|
||||
|
||||
// ErrorCodeNoParent is generated when we try to delete a container
|
||||
// but we can't find its parent image.
|
||||
ErrorCodeNoParent = errcode.Register(errGroup, errcode.ErrorDescriptor{
|
||||
Value: "NOPARENT",
|
||||
Message: "Cannot get parent %s for name %s",
|
||||
Description: "An attempt was made to delete a container but its parent image could not be found",
|
||||
HTTPStatusCode: http.StatusInternalServerError,
|
||||
})
|
||||
|
||||
// ErrorCodeCantDestroy is generated when we try to delete a container
|
||||
// but failed for some reason.
|
||||
ErrorCodeCantDestroy = errcode.Register(errGroup, errcode.ErrorDescriptor{
|
||||
Value: "CANTDESTROY",
|
||||
Message: "Cannot destroy container %s: %v",
|
||||
Description: "An attempt was made to delete a container but it failed",
|
||||
HTTPStatusCode: http.StatusInternalServerError,
|
||||
})
|
||||
|
||||
// ErrorCodeRmRunning is generated when we try to delete a container
|
||||
// but its still running.
|
||||
ErrorCodeRmRunning = errcode.Register(errGroup, errcode.ErrorDescriptor{
|
||||
Value: "RMRUNNING",
|
||||
Message: "Conflict, You cannot remove a running container. Stop the container before attempting removal or use -f",
|
||||
Description: "An attempt was made to delete a container but the container is still running, try to either stop it first or use '-f'",
|
||||
HTTPStatusCode: http.StatusConflict,
|
||||
})
|
||||
|
||||
// ErrorCodeRmFailed is generated when we try to delete a container
|
||||
// but it failed for some reason.
|
||||
ErrorCodeRmFailed = errcode.Register(errGroup, errcode.ErrorDescriptor{
|
||||
Value: "RMFAILED",
|
||||
Message: "Could not kill running container, cannot remove - %v",
|
||||
Description: "An error occurred while trying to delete a running container",
|
||||
HTTPStatusCode: http.StatusInternalServerError,
|
||||
})
|
||||
|
||||
// ErrorCodeRmNotFound is generated when we try to delete a container
|
||||
// but couldn't find it.
|
||||
ErrorCodeRmNotFound = errcode.Register(errGroup, errcode.ErrorDescriptor{
|
||||
Value: "RMNOTFOUND",
|
||||
Message: "Could not kill running container, cannot remove - %v",
|
||||
Description: "An attempt to delete a container was made but the container could not be found",
|
||||
HTTPStatusCode: http.StatusInternalServerError,
|
||||
})
|
||||
|
||||
// ErrorCodeRmState is generated when we try to delete a container
|
||||
// but couldn't set its state to RemovalInProgress.
|
||||
ErrorCodeRmState = errcode.Register(errGroup, errcode.ErrorDescriptor{
|
||||
Value: "RMSTATE",
|
||||
Message: "Failed to set container state to RemovalInProgress: %s",
|
||||
Description: "An attempt to delete a container was made, but there as an error trying to set its state to 'RemovalInProgress'",
|
||||
HTTPStatusCode: http.StatusInternalServerError,
|
||||
})
|
||||
|
||||
// ErrorCodeRmDriverFS is generated when we try to delete a container
|
||||
// but the driver failed to delete its filesystem.
|
||||
ErrorCodeRmDriverFS = errcode.Register(errGroup, errcode.ErrorDescriptor{
|
||||
Value: "RMDRIVERFS",
|
||||
Message: "Driver %s failed to remove root filesystem %s: %s",
|
||||
Description: "While trying to delete a container, the driver failed to remove the root filesystem",
|
||||
HTTPStatusCode: http.StatusInternalServerError,
|
||||
})
|
||||
|
||||
// ErrorCodeRmInit is generated when we try to delete a container
|
||||
// but failed deleting its init filesystem.
|
||||
ErrorCodeRmInit = errcode.Register(errGroup, errcode.ErrorDescriptor{
|
||||
Value: "RMINIT",
|
||||
Message: "Driver %s failed to remove init filesystem %s: %s",
|
||||
Description: "While trying to delete a container, the driver failed to remove the init filesystem",
|
||||
HTTPStatusCode: http.StatusInternalServerError,
|
||||
})
|
||||
|
||||
// ErrorCodeRmFS is generated when we try to delete a container
|
||||
// but failed deleting its filesystem.
|
||||
ErrorCodeRmFS = errcode.Register(errGroup, errcode.ErrorDescriptor{
|
||||
Value: "RMFS",
|
||||
Message: "Unable to remove filesystem for %v: %v",
|
||||
Description: "While trying to delete a container, the driver failed to remove the filesystem",
|
||||
HTTPStatusCode: http.StatusInternalServerError,
|
||||
})
|
||||
|
||||
// ErrorCodeRmExecDriver is generated when we try to delete a container
|
||||
// but failed deleting its exec driver data.
|
||||
ErrorCodeRmExecDriver = errcode.Register(errGroup, errcode.ErrorDescriptor{
|
||||
Value: "RMEXECDRIVER",
|
||||
Message: "Unable to remove execdriver data for %s: %s",
|
||||
Description: "While trying to delete a container, there was an error trying to remove th exec driver data",
|
||||
HTTPStatusCode: http.StatusInternalServerError,
|
||||
})
|
||||
|
||||
// ErrorCodeRmVolumeInUse is generated when we try to delete a container
|
||||
// but failed deleting a volume because its being used.
|
||||
ErrorCodeRmVolumeInUse = errcode.Register(errGroup, errcode.ErrorDescriptor{
|
||||
Value: "RMVOLUMEINUSE",
|
||||
Message: "Conflict: %v",
|
||||
Description: "While trying to delete a container, one of its volumes is still being used",
|
||||
HTTPStatusCode: http.StatusConflict,
|
||||
})
|
||||
|
||||
// ErrorCodeRmVolume is generated when we try to delete a container
|
||||
// but failed deleting a volume.
|
||||
ErrorCodeRmVolume = errcode.Register(errGroup, errcode.ErrorDescriptor{
|
||||
Value: "RMVOLUME",
|
||||
Message: "Error while removing volume %s: %v",
|
||||
Description: "While trying to delete a container, there was an error trying to delete one of its volumes",
|
||||
HTTPStatusCode: http.StatusInternalServerError,
|
||||
})
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user