1
0
Fork 0
mirror of https://github.com/moby/moby.git synced 2022-11-09 12:21:53 -05:00

Fix daemon.getExecConfig(): not using typed errNotRunning() error

This makes daemon.getExecConfig return a errdefs.Conflict() error if the
container is not running.

This was originally the case, but a refactor of this code changed the typed
error (`derr.ErrorCodeContainerNotRunning`) to a non-typed error;
a793564b25

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
Sebastiaan van Stijn 2021-03-22 13:20:40 +01:00
parent dc4a600a78
commit 6eb5720233
No known key found for this signature in database
GPG key ID: 76698F39D527CE8C

View file

@ -59,7 +59,7 @@ func (daemon *Daemon) getExecConfig(name string) (*exec.Config, error) {
return nil, containerNotFound(name) return nil, containerNotFound(name)
} }
if !ctr.IsRunning() { if !ctr.IsRunning() {
return nil, fmt.Errorf("Container %s is not running: %s", ctr.ID, ctr.State.String()) return nil, errNotRunning(ctr.ID)
} }
if ctr.IsPaused() { if ctr.IsPaused() {
return nil, errExecPaused(ctr.ID) return nil, errExecPaused(ctr.ID)