Building images using vyos-build Docker container
The vyos-build build environment includes a Dockerfile to build a Docker container that can be used to build ISOs, as well as other VyOS images.
Any docker host OS should be able to build the docker container as well as the various images. The below instructions start with a Debian 9 "Stretch" Host OS, which can be set up on bare metal or a Virtual Machine. The instructions below use a n1-standard-1 VM on Google Cloud (1 CPU, 3.75GiB memory, 64 GiB SSD), though a smaller VM can likely be used. Local VMs, or one from a different cloud provider should also work fine.
Building vyos-build Docker container
Login to your VM as a user with sudo privileges.
Install needed packages, and any other desired packages:
sudo apt update sudo apt-get install apt-transport-https ca-certificates curl gnupg2 software-properties-common tmux
Install Docker CE:
curl -fsSL https://download.docker.com/linux/debian/gpg | sudo apt-key add - sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/debian $(lsb_release -cs) stable" sudo apt-get update sudo apt-get install docker-ce sudo systemctl start docker
Clone the vyos-build git, and build the Docker image:
git clone https://github.com/vyos/vyos-build cd vyos-build/docker sudo docker build -t vyos-builder .
Enter the docker container and start the build:
sudo docker run -it --privileged -v /home/$USER/vyos-build:/vyos -w="/vyos" vyos-builder bash ./configure make iso
The built ISO will be located inside the container in the /vyos/build directory. To copy it out of the container into the host OS, get the build name and the container ID:
ls /vyos/build (run inside container) sudo docker ps (run from host OS)
You can copy it out of the container from the host OS:
sudo docker cp $CONTAINER_ID:/vyos/build/live-image-amd64.hybrid.iso /path/to/$BUILD_NAME.iso
Building QEMU image
After building the ISO, build the QEMU image inside the Docker container:
You may need to adjust the timing in packer.json for a successful build: see https://forum.vyos.io/t/unable-to-build-qemu-image-using-vyos-build-docker-container/3090
Building Google Cloud/GCE image
Inside the Docker container:
apt-get update apt-get install grub-common grub-pc grub-pc-bin grub2-common
Skip the grub install when asked.
Building the GCE image needs a loop device, check if you have one available:
If not, add one:
mknod /dev/loop0 b 7 0
Then build the GCE image: