The configuration of the Boot2Docker VM, still has a few drawbacks. You can not permanently store, the root password must be set again, SSH keys always changing … and so on. In this part we will change that.
Preconditions
- completed Tutorial Part 1
Create and connect HDD
# change to Default Machine Folder $ cd VirtualBox\ VMs/ # create storage medium for VM $ VBoxManage createhd --filename ./Boot2DockerVM/disk.vdi --size 8000 # attache storage medium to VM $ VBoxManage storageattach "Boot2DockerVM" --storagectl "IDE" --port 1 --device 0 --type hdd --medium ./Boot2DockerVM/disk.vdi # reconfigure boot settings of VM $ VBoxManage modifyvm "Boot2DockerVM" --boot1 dvd --boot2 disk --boot3 none --boot4 none # start vm $ VBoxManage startvm Boot2DockerVM --type gui
Prepare disk
# format disk $ mkfs.ext4 /dev/sda # mark filesystem $ tune2fs -L boot2docker-data /dev/sda # restart VM $ reboot
Set permanent root password
# check disk $ df -h # change directory $ cd /mnt/sda/var/lib/boot2docker/ # create bootlocal.sh $ vi bootlocal.sh # content of bootlocal.sh (please use your own password) echo "root:test123" | chpasswd # change access rights $ chmod +x bootlocal.sh
From this point, you can connect via SSH as root user.