Don't check for docker.io prefix in docker preload

Right now, preload isn't working because it thinks that the
kubernetes/dashboard images don't exist. This is because they now have a
docker.io prefix introduced by 4c54e78681

Since `docker images` won't return image names with that prefix, we want
to strip the images of `docker.io` before checking if they exists in the
docker daemon.

This also fixes the TestPause/serial/SecondStartNoReconfiguration
failing integration test.
pull/9676/head
Priya Wadhwa 2020-11-11 13:53:06 -08:00
parent abd18a123f
commit 7fb0a9e0c1
1 changed files with 9 additions and 0 deletions

View File

@ -375,6 +375,7 @@ func dockerImagesPreloaded(runner command.Runner, images []string) bool {
}
preloadedImages := map[string]struct{}{}
for _, i := range strings.Split(rr.Stdout.String(), "\n") {
i = trimDockerIO(i)
preloadedImages[i] = struct{}{}
}
@ -382,6 +383,7 @@ func dockerImagesPreloaded(runner command.Runner, images []string) bool {
// Make sure images == imgs
for _, i := range images {
i = trimDockerIO(i)
if _, ok := preloadedImages[i]; !ok {
klog.Infof("%s wasn't preloaded", i)
return false
@ -390,6 +392,13 @@ func dockerImagesPreloaded(runner command.Runner, images []string) bool {
return true
}
// Remove docker.io prefix since it won't be included in images names
// when we call 'docker images'
func trimDockerIO(name string) string {
name = strings.TrimPrefix(name, "docker.io/")
return name
}
func dockerBoundToContainerd(runner command.Runner) bool {
// NOTE: assumes systemd
rr, err := runner.RunCmd(exec.Command("sudo", "systemctl", "cat", "docker.service"))