communitytools-image2docker-linux icon indicating copy to clipboard operation
communitytools-image2docker-linux copied to clipboard

Display a proper error message when guestfish can't read the VMDK file

Open brandonroyal opened this issue 7 years ago • 5 comments

When running image2docker against a clean VM created in VMware or VirtualBox, I get the following error:

Current Result

$ i2d build ../vmware-test.vmdk
Running image transformation.
Creating container for v2c/guestfish-export:1
The packager failed with code: 1

Expected Result

Successfully created Dockerfile

Repro Steps

  1. Setup ubuntu 16.04 VM in VirtualBox or VMware Fusion
  2. Shutdown VM
  3. Run I2D against .vmdk file

brandonroyal avatar Jul 27 '17 17:07 brandonroyal

It looks like the VMDK file was unreadable. We tried to load it into Fusion and it didn't like it.

We should also be more explicit in our docs about how to generate the VMDK files correctly.

pdevine avatar Jul 27 '17 17:07 pdevine

@BrandonRoyal it looks like you didn't convert the VMDK file into a single, growable virtual disk. You can make this work with the vmware-vdiskmanager tool which is shipped with VMware Fusion and Workstation (although it looks like it's not shipped along w/ VMware Player unfortunately).

To run it, use the command vmware-vdiskmanager -r <source virtual disk> -t 0 <target virtual disk>. That will combine any split virtual disk files into one big shiny one.

pdevine avatar Jul 27 '17 18:07 pdevine

@pdevine no luck :-(

$ vmware-vdiskmanager -r "Virtual Disk.vmdk" -t 0 mta-lab.vmdk
Creating disk 'mta-lab.vmdk'
  Convert: 100% done.
Virtual disk conversion successful.
$ i2d build ~/mta-lab.vmdk
Running image transformation.
Creating container for v2c/guestfish-export:1
The packager failed with code: 1

brandonroyal avatar Jul 28 '17 05:07 brandonroyal

@pdevine The images have to be monolithic flat and not monolithic sparse. @BrandonRoyal the command you used was almost correct. Instead try:

vmware-vdiskmanager -r "Virtual Disk.vmdk" -t 2 mta-lab-flat.vmdk

allingeek avatar Jul 28 '17 05:07 allingeek

@allingeek @pdevine unfortunately that doesn't seem to have done it either.

$ vmware-vdiskmanager -r "Virtual Disk.vmdk" -t 2 mta-lab.vmdk
Creating disk 'mta-lab.vmdk'
  Convert: 100% done.
Virtual disk conversion successful.
$ i2d build ~/mta-lab.vmdk
Running image transformation.
Creating container for v2c/guestfish-export:1
The packager failed with code: 1

brandonroyal avatar Jul 28 '17 06:07 brandonroyal