mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
add ExecIDs in inspect
Signed-off-by: Victor Vieux <vieux@docker.com>
This commit is contained in:
parent
8412e3c226
commit
4b43a6df7a
2 changed files with 19 additions and 3 deletions
|
@ -35,7 +35,7 @@ type execConfig struct {
|
|||
|
||||
type execStore struct {
|
||||
s map[string]*execConfig
|
||||
sync.Mutex
|
||||
sync.RWMutex
|
||||
}
|
||||
|
||||
func newExecStore() *execStore {
|
||||
|
@ -49,9 +49,9 @@ func (e *execStore) Add(id string, execConfig *execConfig) {
|
|||
}
|
||||
|
||||
func (e *execStore) Get(id string) *execConfig {
|
||||
e.Lock()
|
||||
e.RLock()
|
||||
res := e.s[id]
|
||||
e.Unlock()
|
||||
e.RUnlock()
|
||||
return res
|
||||
}
|
||||
|
||||
|
@ -61,6 +61,16 @@ func (e *execStore) Delete(id string) {
|
|||
e.Unlock()
|
||||
}
|
||||
|
||||
func (e *execStore) List() []string {
|
||||
var IDs []string
|
||||
e.RLock()
|
||||
for id, _ := range e.s {
|
||||
IDs = append(IDs, id)
|
||||
}
|
||||
e.RUnlock()
|
||||
return IDs
|
||||
}
|
||||
|
||||
func (execConfig *execConfig) Resize(h, w int) error {
|
||||
return execConfig.ProcessConfig.Terminal.Resize(h, w)
|
||||
}
|
||||
|
@ -249,6 +259,10 @@ func (d *Daemon) Exec(c *Container, execConfig *execConfig, pipes *execdriver.Pi
|
|||
return exitStatus, err
|
||||
}
|
||||
|
||||
func (container *Container) GetExecIDs() []string {
|
||||
return container.execCommands.List()
|
||||
}
|
||||
|
||||
func (container *Container) Exec(execConfig *execConfig) error {
|
||||
container.Lock()
|
||||
defer container.Unlock()
|
||||
|
|
|
@ -50,6 +50,8 @@ func (daemon *Daemon) ContainerInspect(job *engine.Job) engine.Status {
|
|||
out.SetJson("VolumesRW", container.VolumesRW)
|
||||
out.SetJson("AppArmorProfile", container.AppArmorProfile)
|
||||
|
||||
out.SetList("ExecIDs", container.GetExecIDs())
|
||||
|
||||
if children, err := daemon.Children(container.Name); err == nil {
|
||||
for linkAlias, child := range children {
|
||||
container.hostConfig.Links = append(container.hostConfig.Links, fmt.Sprintf("%s:%s", child.Name, linkAlias))
|
||||
|
|
Loading…
Reference in a new issue