Installing Alpine in a single partition is a bit of a PITA since the installer always creates boot and swap partitions if you let it prepare the disk. A single partition is worth doing since it makes it easier to shrink the VDI. I finally managed to do it, so here is what I did:
Start with the VM install image since it is tiny (38MB).
fdisk
and create the partition on /dev/sda
. Use the entire disk. Make it bootable/dev/sda1
exists, and if not reboot from the ISO again.apk add
working:
sysctl net.ipv6.conf.all.disable_ipv6=1
setup-interfaces
rc-service networking start
setup-apkrepos
e2fsprogs
.apk add e2fsprogs
/dev/sda1
. Make sure it uses the 32 bit layout since syslinux is a bit crap (you need to do this even with 64 bit guest images):mkfs.ext4 -O ^64bit -m 1 -L alpine /dev/sda1
/mnt
. Explicitly set the FS type using -t ext4
:mount -t ext4 /dev/sda1 /mnt
/boot
in the mounted FS:mkdir /mnt/boot
setup-alpine
. If asked about disks, answer none
(it might not ask since the only disk is already mounted). Also answer none
for configs and APK cache.setup-disk
to install the base image:setup-disk -m sys /mnt
dd bs=440 count=1 conv=notrunc if=/usr/share/syslinux/mbr.bin of=/dev/sda
e2fsprogs
so that fsck can check the disk on start-up:apk add --no-cache e2fsprogs
Install via APK rather than the VirtualBox ISO.
/etc/apk/repositories
.apk add --no-cache virtualbox-guest-additions virtualbox-guest-modules-virt
/etc/modules
so that they load on start-up:echo vboxguest >> /etc/modules echo vboxsf >> /etc/modules
rc-update add virtualbox-guest-additions
This will allow shared folders to be auto-mounted.
Install:
apk add docker apk add docker-compose
Enable on start-up:
rc-update add docker
mv /etc/profile.d/color_prompt /etc/profile.d/color_prompt.sh
Create /etc/profile.d/aliases.sh
, with the following contents:
alias ls='ls -ahp --color=auto --group-directories-first' alias ll='ls -l'
apk add
working:
setup-interfaces
rc-service networking start
setup-apkrepos
/etc/apk/repositories
.zerofree
.zerofree
to zero the free space:zerofree -v /dev/sda1
VBoxManage modifymedium disk "<path to VDI>" --compact