// metadataLayerEquivalent returns true if the last layer of a is equivalent to b, assuming // that b is squashed over multiple layers, and a is not. b, for instance, will have an empty // slice entrypoint, while a would have a nil entrypoint. func metadataLayerEquivalent(a, b *docker.Config) bool { if a.Entrypoint == nil && len(b.Entrypoint) == 0 { // we are forced to set Entrypoint [] to reset the entrypoint b.Entrypoint = nil } if len(a.OnBuild) == 1 && len(b.OnBuild) > 0 && a.OnBuild[0] == b.OnBuild[len(b.OnBuild)-1] { // a layered file will only contain the last OnBuild statement b.OnBuild = a.OnBuild } return metadataEqual(a, b) }