imagerefchecker: fix concurrent map access

Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
docker-18.09
Tonis Tiigi 2018-09-27 17:12:35 -07:00
parent 8f4dff0d16
commit e210ffc72e
1 changed files with 4 additions and 0 deletions

View File

@ -90,9 +90,13 @@ func (c *checker) init() {
return
}
var mu sync.Mutex
for _, img := range imgs {
if err := images.Dispatch(context.TODO(), images.Handlers(layersHandler(c.opt.ContentStore, func(layers []specs.Descriptor) {
mu.Lock()
c.registerLayers(layers)
mu.Unlock()
})), img.Target); err != nil {
return
}