Building images using vyos-build Docker container

From VyOS Wiki
Jump to: navigation, search
Warning sign.png This page is migrated to Readthedocs .
Information found on this page is migrated to readthedocs and information found here could be outdated or misleading.

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 | sudo apt-key add -
sudo add-apt-repository "deb [arch=amd64] $(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
cd vyos-build/docker
sudo docker build -t vyos-builder .

Building ISOs

Enter the docker container and start the build:

sudo docker run -it --privileged -v /home/$USER/vyos-build:/vyos -w="/vyos" vyos-builder bash
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:

make qemu

You may need to adjust the timing in packer.json for a successful build: see

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:

 ls /dev/loop*

If not, add one:

 mknod /dev/loop0 b 7 0

Then build the GCE image:

 make GCE