mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
Merge pull request #6430 from LK4D4/lock_inspect
Do inspect under container lock
This commit is contained in:
commit
d671768b52
1 changed files with 3 additions and 1 deletions
|
@ -13,11 +13,13 @@ func (daemon *Daemon) ContainerInspect(job *engine.Job) engine.Status {
|
||||||
}
|
}
|
||||||
name := job.Args[0]
|
name := job.Args[0]
|
||||||
if container := daemon.Get(name); container != nil {
|
if container := daemon.Get(name); container != nil {
|
||||||
|
container.Lock()
|
||||||
|
defer container.Unlock()
|
||||||
if job.GetenvBool("dirty") {
|
if job.GetenvBool("dirty") {
|
||||||
b, err := json.Marshal(&struct {
|
b, err := json.Marshal(&struct {
|
||||||
*Container
|
*Container
|
||||||
HostConfig *runconfig.HostConfig
|
HostConfig *runconfig.HostConfig
|
||||||
}{container, container.HostConfig()})
|
}{container, container.hostConfig})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return job.Error(err)
|
return job.Error(err)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue