No description
- Shell 81.5%
- Dockerfile 18.5%
|
All checks were successful
Build / Building cloud-container (push) Successful in 29m15s
Signed-off-by: Nabil-Salah <nabil.salah203@gmail.com> |
||
|---|---|---|
| .github/workflows | ||
| initcpio | ||
| .dockerignore | ||
| .gitignore | ||
| build.sh | ||
| config | ||
| Dockerfile | ||
| init | ||
| init_functions | ||
| LICENSE | ||
| mkinitcpio.conf | ||
| readme.md | ||
| test.sh | ||
Introduction
cloud-container is a builder for a custom initramfs image that allows running containers on cloud-hypervisor. The container root is served over virtiofs.
The initramfs does the following:
- Add all required
virtiomodules to supportvirtiofs,pci, anddisks - Expose environment variables from
/etc/environmentto the containerentrypoint. A container manager can simply write down the /etc/environment file in the container root before booting. - Pre-mount attached disks to configured endpoints
- Configure network interface via cmdline argument passed to the kernel
Kernel Requirements
This repository builds only the initramfs. You must provide a compatible Linux kernel separately.
Tested with Linux 6.8 (or later). Ensure your kernel includes:
CONFIG_VIRTIO=y,CONFIG_VIRTIO_PCI=y,CONFIG_VIRTIO_BLK=y,CONFIG_VIRTIO_NET=yCONFIG_VIRTIO_FS=y(for virtiofs support)- Basic filesystem support (ext4, vfat, etc.)
Use the config file from this repo as a reference when building your kernel.
Building
Requirements: docker
Build the initramfs:
./build.sh
This produces:
output/initramfs-linux.img— the initramfs imageoutput/hypervisor-fw— cloud-hypervisor firmware
Testing with cloud-hypervisor
Requirements: cloud-hypervisor, a Linux kernel (bzImage)
Extract or mount a container rootfs, then run:
cloud-hypervisor \
--kernel /path/to/bzImage \
--initramfs output/initramfs-linux.img \
--cmdline "console=ttyS0 root=/dev/vda" \
--console off \
--serial tty
To edit environment variables available to your entrypoint, edit
<rootfs>/etc/environment
See test.sh for a more complete example.