Add an exception for 'latest' images

pull/11603/head
Ilya Zuyev 2021-06-07 17:41:50 -07:00
parent 557d3a5504
commit 6261f9d400
1 changed files with 8 additions and 1 deletions

View File

@ -17,6 +17,7 @@ limitations under the License.
package download
import (
"fmt"
"os"
"os/exec"
"path"
@ -192,7 +193,13 @@ func CacheToDaemon(img string) error {
tag, ref, err := parseImage(img)
if err != nil {
return nil
return err
}
// do not use cache if image is set in format <name>:latest
if _, ok := ref.(name.Tag); ok {
if tag.Name() == "latest" {
return fmt.Errorf("can't cache 'latest' tag")
}
}
i, err := tarball.ImageFromPath(p, tag)