Docker Community Forums

Share and learn in the Docker community.

VM 2 CONTAINER : instruction [ $ sudo qemu-nbd -c /dev/nbd0 -r $VMDISK3((CO1-3)) //3] but getting errors... well

p.49 book
docker-in-practice-second-edition
Listing 3.1 Extracting the filesystem of a VM image
Chapter 3. Using Docker as a lightweight virtual machine · Docker in Practice, Second Edition >>>

$ VMDISK="HOME/VirtualBox VMs/myvm/myvm.vdi" 1 sudo modprobe nbd 2
$ sudo qemu-nbd -c /dev/nbd0 -r VMDISK3((CO1-3)) 3 ls /dev/nbd0p* 4
/dev/nbd0p1 /dev/nbd0p2
sudo mount /dev/nbd0p2 /mnt 5 sudo tar cf img.tar -C /mnt . 6
$ sudo umount /mnt && sudo qemu-nbd -d /dev/nbd0 7

I tried the 3rd cmd line instruction [ $ sudo qemu-nbd -c /dev/nbd0 -r $VMDISK3((CO1-3)) //3] but getting errors… well? see below…

leonidas@ubuntu:~/Documents/docker-in-practise/t11-t14$ VMDISK="$HOME/Documents/docker-in-practise/t11-t14/ubuntu-18.04-amd64-disk001.vmdk" 
leonidas@ubuntu:~/Documents/docker-in-practise/t11-t14$ sudo modprobe nbd 
leonidas@ubuntu:~/Documents/docker-in-practise/t11-t14$ sudo qemu-nbd -c /dev/nbd0 -r $VMDISK3((CO1-3))
**bash: syntax error near unexpected token `('**
leonidas@ubuntu:~/Documents/docker-in-practise/t11-t14$ ls /dev/nbd*
/dev/nbd0  /dev/nbd1  /dev/nbd10  /dev/nbd11  /dev/nbd12  /dev/nbd13  /dev/nbd14  /dev/nbd15  /dev/nbd2  /dev/nbd3  /dev/nbd4  /dev/nbd5  /dev/nbd6  /dev/nbd7  /dev/nbd8  /dev/nbd9
leonidas@ubuntu:~/Documents/docker-in-practise/t11-t14$ ls -la
total 7079884
drwxrwxr-x 2 leonidas leonidas       4096 Mar  5 03:53 .
drwxrwxr-x 9 leonidas leonidas       4096 Dec  8 23:07 ..
-rwxrw-rw- 1 leonidas leonidas 7249788928 Mar  5 03:51 ubuntu-18.04-amd64-disk001.vmdk
leonidas@ubuntu:~/Documents/docker-in-practise/t11-t14$