1
0

feat: save container images

This commit is contained in:
2024-02-21 12:11:57 +00:00
parent 94d0cf1ae4
commit a8066428f8
3 changed files with 57 additions and 1 deletions

View File

@ -95,6 +95,26 @@ func Import(path, name string) (err error) {
return
}
func Save(name, path string) (err error) {
exist := Container{name: name}.Exist()
if !exist {
err = errors.New("container does not exist")
log.Error().Err(err).Msg("")
return
}
cmd := exec.Command(Runtime, "save", name, path)
log.Debug().Msgf("%v", cmd)
raw, err := cmd.CombinedOutput()
if err != nil {
log.Error().Err(err).Msg(string(raw))
return
}
return
}
type Volume struct {
Src, Dest string
}