Unable to create partitions on vmdk device in Docker

45 Views Asked by At

Is it possible to create a vmdk image using Docker?

My actions for this:

I activate the nbd module, launch a container with privileges.

# qemu-img create -f vmdk image.vmdk 10G
Formatting 'image.vmdk', fmt=vmdk size=10737418240 compat6=off hwversion=undefined
# qemu-nbd -c /dev/nbd0 image.vmdk
# parted /dev/nbd0 mklabel gpt
Information: You may need to update /etc/fstab.

# parted /dev/nbd0 mkpart BIOS_Boot_Partition 2048s 4095s
Information: You may need to update /etc/fstab.

# parted /dev/nbd0 set 1 bios_grub on
Information: You may need to update /etc/fstab.

# parted /dev/nbd0 mkpart LVM 4096s 100%
Information: You may need to update /etc/fstab.

# parted /dev/nbd0 set 2 lvm on
Information: You may need to update /etc/fstab.

# pvcreate /dev/nbd0p2
  No device found for /dev/nbd0p2.

That is, after creating partitions on vmdk, nbd0p* links are not created on them. The same algorithm works outside of docker. Maybe you need to give some permissions to create links?

0

There are 0 best solutions below