From c3c97c382893d3cc6a032b81eb8a23564f1e512a Mon Sep 17 00:00:00 2001 From: Mikhail Klementev Date: Sun, 6 Oct 2024 15:33:35 +0000 Subject: [PATCH] fix: untag duplicate image in case of docker --- container/container.go | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/container/container.go b/container/container.go index 1a7381b..fd479f2 100644 --- a/container/container.go +++ b/container/container.go @@ -97,13 +97,23 @@ func Load(localpath string, name string) (err error) { return } - cmd = exec.Command(Runtime, "tag", "localhost/"+name, name) - log.Debug().Msgf("%v", cmd) + if strings.Contains(Runtime, "docker") { + var err2 error + cmd = exec.Command(Runtime, "tag", "localhost/"+name, name) + log.Debug().Msgf("%v", cmd) - raw, err = cmd.CombinedOutput() - if err != nil { - log.Debug().Err(err).Msg(string(raw)) - return + raw, err2 = cmd.CombinedOutput() + if err2 != nil { + log.Debug().Err(err2).Msg(string(raw)) + } + + cmd = exec.Command(Runtime, "rmi", "localhost/"+name) + log.Debug().Msgf("%v", cmd) + + raw, err2 = cmd.CombinedOutput() + if err2 != nil { + log.Debug().Err(err2).Msg(string(raw)) + } } return