mirror of
https://github.com/linka-cloud/d2vm.git
synced 2025-12-14 15:03:12 +00:00
add keep-cache option to preserve intermediate docker images
Signed-off-by: Adphi <philippe.adrien.nousse@gmail.com>
This commit is contained in:
@@ -65,13 +65,17 @@ func Convert(ctx context.Context, img string, opts ...ConvertOption) error {
|
||||
if err := docker.Build(ctx, imgUUID, p, dir); err != nil {
|
||||
return err
|
||||
}
|
||||
defer docker.Remove(ctx, imgUUID)
|
||||
if !o.keepCache {
|
||||
defer docker.Remove(ctx, imgUUID)
|
||||
}
|
||||
} else {
|
||||
// for raw images, we just tag the image with the uuid
|
||||
if err := docker.Tag(ctx, img, imgUUID); err != nil {
|
||||
return err
|
||||
}
|
||||
defer docker.Remove(ctx, imgUUID)
|
||||
if !o.keepCache {
|
||||
defer docker.Remove(ctx, imgUUID)
|
||||
}
|
||||
}
|
||||
|
||||
logrus.Infof("creating vm image")
|
||||
|
||||
Reference in New Issue
Block a user