Implement APIv2 Exec Create and Inspect Endpoints

Start and Resize require further implementation work.

Signed-off-by: Matthew Heon <matthew.heon@pm.me>
This commit is contained in:
Matthew Heon
2020-03-20 15:23:35 -04:00
parent 3e835a8025
commit 0c40b62c77
6 changed files with 200 additions and 64 deletions

View File

@ -830,6 +830,24 @@ func (r *Runtime) GetLatestContainer() (*Container, error) {
return ctrs[lastCreatedIndex], nil
}
// GetExecSessionContainer gets the container that a given exec session ID is
// attached to.
func (r *Runtime) GetExecSessionContainer(id string) (*Container, error) {
r.lock.RLock()
defer r.lock.RUnlock()
if !r.valid {
return nil, define.ErrRuntimeStopped
}
ctrID, err := r.state.GetExecSession(id)
if err != nil {
return nil, err
}
return r.state.Container(ctrID)
}
// PruneContainers removes stopped and exited containers from localstorage. A set of optional filters
// can be provided to be more granular.
func (r *Runtime) PruneContainers(filterFuncs []ContainerFilter) (map[string]int64, map[string]error, error) {