1
0
Fork 0
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:
Victor Vieux 2014-12-23 22:03:20 +00:00
parent 8412e3c226
commit 4b43a6df7a
2 changed files with 19 additions and 3 deletions

View file

@ -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()

View file

@ -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))