It fixes some race conditions
Docker-DCO-1.1-Signed-off-by: Alexandr Morozov <lk4d4math@gmail.com> (github: LK4D4)
| ... | ... |
@@ -13,11 +13,13 @@ func (daemon *Daemon) ContainerInspect(job *engine.Job) engine.Status {
|
| 13 | 13 |
} |
| 14 | 14 |
name := job.Args[0] |
| 15 | 15 |
if container := daemon.Get(name); container != nil {
|
| 16 |
+ container.Lock() |
|
| 17 |
+ defer container.Unlock() |
|
| 16 | 18 |
if job.GetenvBool("dirty") {
|
| 17 | 19 |
b, err := json.Marshal(&struct {
|
| 18 | 20 |
*Container |
| 19 | 21 |
HostConfig *runconfig.HostConfig |
| 20 |
- }{container, container.HostConfig()})
|
|
| 22 |
+ }{container, container.hostConfig})
|
|
| 21 | 23 |
if err != nil {
|
| 22 | 24 |
return job.Error(err) |
| 23 | 25 |
} |