img: pull image if not locally present while extracting

This commit is contained in:
Ettore Di Giacinto
2021-01-24 13:17:11 +01:00
parent 76e5d37895
commit be87861657

View File

@@ -147,10 +147,16 @@ func (*SimpleImg) ExportImage(opts compiler.CompilerBackendOptions) error {
}
// ExtractRootfs extracts the docker image content inside the destination
func (*SimpleImg) ExtractRootfs(opts compiler.CompilerBackendOptions, keepPerms bool) error {
func (s *SimpleImg) ExtractRootfs(opts compiler.CompilerBackendOptions, keepPerms bool) error {
name := opts.ImageName
path := opts.Destination
if !s.ImageExists(name) {
if err := s.DownloadImage(opts); err != nil {
return errors.Wrap(err, "failed pulling image "+name+" during extraction")
}
}
os.RemoveAll(path)
buildarg := []string{"unpack", "-o", path, name}
Debug(":tea: Extracting image " + name)