1
0

fix: use image load

This commit is contained in:
dump_stack() 2024-02-21 18:57:10 +00:00
parent 8251927821
commit c17676d0f9
Signed by: dump_stack
GPG Key ID: C9905BA72B5E02BB
2 changed files with 19 additions and 1 deletions

View File

@ -175,7 +175,7 @@ func (cmd *KernelCmd) fetchContainerCache(c container.Container) {
}
path := cache.ContainerURL(c.Name())
err := container.Import(path, c.Name())
err := container.Load(path, c.Name())
if err == nil {
log.Info().Msgf("container %s -> %s", path, c.Name())
}

View File

@ -77,6 +77,24 @@ func Images() (diis []Image, err error) {
return
}
func Load(path string) (err error) {
exist := Container{name: name}.Exist()
if exist && UseCache {
return
}
cmd := exec.Command(Runtime, "load", "-i", path)
log.Debug().Msgf("%v", cmd)
raw, err := cmd.CombinedOutput()
if err != nil {
log.Debug().Err(err).Msg(string(raw))
return
}
return
}
func Import(path, name string) (err error) {
exist := Container{name: name}.Exist()
if exist && UseCache {