mirror of
https://github.com/docker/cli.git
synced 2026-09-10 10:05:19 -05:00
server/buildfile.go -> builder/builder.go; add maintainers file
Docker-DCO-1.1-Signed-off-by: Erik Hollensbe <github@hollensbe.org> (github: erikh) Upstream-commit: 3a177ccd3afdfe481a7248fccb2efe0f2cbdfcca Component: engine
This commit is contained in:
@@ -513,7 +513,7 @@ func (container *Container) monitor(callback execdriver.StartCallback) error {
|
||||
if container.daemon != nil && container.daemon.srv != nil && container.daemon.srv.IsRunning() {
|
||||
// FIXME: here is race condition between two RUN instructions in Dockerfile
|
||||
// because they share same runconfig and change image. Must be fixed
|
||||
// in server/buildfile.go
|
||||
// in builder/builder.go
|
||||
if err := container.toDisk(); err != nil {
|
||||
utils.Errorf("Error dumping container %s state to disk: %s\n", container.ID, err)
|
||||
}
|
||||
|
||||
@@ -1099,3 +1099,35 @@ func (daemon *Daemon) checkLocaldns() error {
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (daemon *Daemon) ImageGetCached(imgID string, config *runconfig.Config) (*image.Image, error) {
|
||||
// Retrieve all images
|
||||
images, err := daemon.Graph().Map()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
// Store the tree in a map of map (map[parentId][childId])
|
||||
imageMap := make(map[string]map[string]struct{})
|
||||
for _, img := range images {
|
||||
if _, exists := imageMap[img.Parent]; !exists {
|
||||
imageMap[img.Parent] = make(map[string]struct{})
|
||||
}
|
||||
imageMap[img.Parent][img.ID] = struct{}{}
|
||||
}
|
||||
|
||||
// Loop on the children of the given image and check the config
|
||||
var match *image.Image
|
||||
for elem := range imageMap[imgID] {
|
||||
img, err := daemon.Graph().Get(elem)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if runconfig.Compare(&img.ContainerConfig, config) {
|
||||
if match == nil || match.Created.Before(img.Created) {
|
||||
match = img
|
||||
}
|
||||
}
|
||||
}
|
||||
return match, nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user