MCPcopy Index your code
hub / github.com/moby/moby / getExecConfig

Method getExecConfig

daemon/exec.go:45–70  ·  view source on GitHub ↗

getExecConfig looks up the exec instance by name. If the container associated with the exec instance is stopped or paused, it will return an error.

(name string)

Source from the content-addressed store, hash-verified

43// getExecConfig looks up the exec instance by name. If the container associated
44// with the exec instance is stopped or paused, it will return an error.
45func (daemon *Daemon) getExecConfig(name string) (*container.ExecConfig, error) {
46 ec := daemon.execCommands.Get(name)
47 if ec == nil {
48 return nil, errExecNotFound(name)
49 }
50
51 // If the exec is found but its container is not in the daemon's list of
52 // containers then it must have been deleted, in which case instead of
53 // saying the container isn't running, we should return a 404 so that
54 // the user sees the same error now that they will after the
55 // 5 minute clean-up loop is run which erases old/dead execs.
56 ctr := daemon.containers.Get(ec.Container.ID)
57 if ctr == nil {
58 return nil, containerNotFound(name)
59 }
60 if !ctr.State.IsRunning() {
61 return nil, errNotRunning(ctr.ID)
62 }
63 if ctr.State.IsPaused() {
64 return nil, errExecPaused(ctr.ID)
65 }
66 if ctr.State.IsRestarting() {
67 return nil, errContainerIsRestarting(ctr.ID)
68 }
69 return ec, nil
70}
71
72func (daemon *Daemon) unregisterExecCommand(container *container.Container, execConfig *container.ExecConfig) {
73 container.ExecCommands.Delete(execConfig.ID)

Callers 4

ExecExistsMethod · 0.95
ContainerExecStartMethod · 0.95
ContainerExecResizeMethod · 0.95
runMethod · 0.80

Calls 9

errExecNotFoundFunction · 0.85
containerNotFoundFunction · 0.85
errNotRunningFunction · 0.85
errExecPausedFunction · 0.85
errContainerIsRestartingFunction · 0.85
IsPausedMethod · 0.80
IsRestartingMethod · 0.80
GetMethod · 0.65
IsRunningMethod · 0.65

Tested by

no test coverage detected