docker-archive / communitytools-image2docker-linux

116 stars 42 forks source link

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

Open brandonroyal opened 6 years ago

brandonroyal commented 6 years ago

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
pdevine commented 6 years ago

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 commented 6 years ago

@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.

brandonroyal commented 6 years ago

@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
allingeek commented 6 years ago

@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
brandonroyal commented 6 years ago

@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