diff options
| author | Christian Breunig <christian@breunig.cc> | 2026-03-18 09:40:08 +0100 |
|---|---|---|
| committer | Christian Breunig <christian@breunig.cc> | 2026-03-18 09:40:08 +0100 |
| commit | 23e518ae0d3e3ff07a0a250f9f181ee982d42a1c (patch) | |
| tree | bfa50c84d37e27c1b7dea9e13d96fe71a02fc523 | |
| parent | 96ff51d3d2e559194f86ea99f817c86d1a1bfd20 (diff) | |
| download | vyos-build-23e518ae0d3e3ff07a0a250f9f181ee982d42a1c.tar.gz vyos-build-23e518ae0d3e3ff07a0a250f9f181ee982d42a1c.zip | |
T8401: remove docker-vyos in favour of OCI (Open Container Image) format
vyos_bld 5b8e3dd7a1a8:/vyos/vyos-build [current] # ls -al build/*.iso
-rw-r--r-- 1 root root 680525824 Mar 18 08:21 build/live-image-amd64.hybrid.iso
-rw-r--r-- 1 root root 680525824 Mar 18 08:31 build/vyos-2026.03.18-0821-oci-generic-amd64.iso
vyos_bld 5b8e3dd7a1a8:/vyos/vyos-build [current] # sudo make oci
I: mount ISO build/live-image-amd64.hybrid.iso
I: extracting squashfs content
I: generate OCI container image vyos-2026.03.18-0821-oci.tar
I: to import the previously generated OCI image to your local images run:
docker import vyos-2026.03.18-0821-oci.tar vyos:2026.03.18-0821-oci --change 'CMD [/sbin/init]'
vyos_bld 5b8e3dd7a1a8:/vyos/vyos-build [current] # ls -al *.tar
-rw-r--r-- 1 root root 2039336960 Mar 18 08:38 vyos-2026.03.18-0821-oci.tar
| -rw-r--r-- | docker-vyos/Dockerfile | 105 | ||||
| -rw-r--r-- | docker-vyos/README.md | 82 | ||||
| -rw-r--r-- | docker-vyos/vyos_install_common.sh | 96 | ||||
| -rw-r--r-- | docker-vyos/vyos_install_stage_01.sh | 105 | ||||
| -rw-r--r-- | docker-vyos/vyos_install_stage_02.sh | 65 | ||||
| -rw-r--r-- | docker-vyos/vyos_install_stage_03.sh | 63 |
6 files changed, 0 insertions, 516 deletions
diff --git a/docker-vyos/Dockerfile b/docker-vyos/Dockerfile deleted file mode 100644 index 3fff371b..00000000 --- a/docker-vyos/Dockerfile +++ /dev/null @@ -1,105 +0,0 @@ -# syntax = docker/dockerfile:1 - -# Copyright (C) 2020-2023 VyOS maintainers and contributors -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License version 2 or later as -# published by the Free Software Foundation. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see <http://www.gnu.org/licenses/>. - -# Define arguments for VyOS image -ARG VYOS_VERSION -ARG BUILD_DATE - -# Use Debian as base layer -FROM debian:bookworm-slim - -LABEL authors="VyOS Maintainers <maintainers@vyos.io>" -ENV DEBIAN_FRONTEND noninteractive - -RUN /bin/echo -e 'APT::Install-Recommends "0";\nAPT::Install-Suggests "0";' > /etc/apt/apt.conf.d/01norecommends -# Clean cache after each apt-get install command so that it is not stored in the image -RUN /bin/echo -e 'DPkg::Post-Invoke {"/bin/rm -f /var/cache/apt/archives/*.deb /var/lib/apt/lists/* || true";};' > /etc/apt/apt.conf.d/clean - -# Base packaged needed to build packages and their package dependencies -RUN apt-get update && apt-get install -y \ - ca-certificates \ - gnupg \ - curl \ - fuse-overlayfs \ - jq \ - yq - -# Copy installer script and default build settings -COPY [ "data/defaults.toml", \ - "data/live-build-config/archives/*", \ - "docker-vyos/vyos_install_common.sh", \ - "docker-vyos/vyos_install_stage_01.sh", \ - "/tmp/"] -COPY [ "data/architectures/*", "/tmp/architectures_triage/" ] -COPY [ "data/live-build-config/hooks/live/*", "/tmp/hooks/" ] - -# Install VyOS dependencies -WORKDIR /tmp -RUN bash -c 'mv /tmp/architectures_triage/$(dpkg --print-architecture).toml /tmp && rm -rf /tmp/architectures_triage' -RUN bash /tmp/vyos_install_stage_01.sh - - -# Install VyOS specific software -COPY [ "data/defaults.toml", \ - "docker-vyos/vyos_install_common.sh", \ - "docker-vyos/vyos_install_stage_02.sh", "/tmp/" ] -COPY [ "data/architectures/*", "/tmp/architectures_triage/" ] -RUN bash -c 'mv /tmp/architectures_triage/$(dpkg --print-architecture).toml /tmp && rm -rf /tmp/architectures_triage' -RUN bash /tmp/vyos_install_stage_02.sh - - -# Tune system for VyOS -COPY [ "docker-vyos/vyos_install_common.sh", "docker-vyos/vyos_install_stage_03.sh", "/tmp/" ] -# Copy default config -COPY tools/container/config.boot.default /opt/vyatta/etc/ - -RUN bash /tmp/vyos_install_stage_03.sh - -# Delete installer scripts -RUN rm -rf /tmp/* - -# Remove cleanup script so that in-container apt-get install uses cache -RUN rm /etc/apt/apt.conf.d/clean - - -# Make changes specific to the container environment - -# Tell systemd that we are inside container -ENV container=docker - -# Set proper STOPSIGNAL -STOPSIGNAL SIGRTMIN+3 - -# Run VyOS -CMD [ "/lib/systemd/systemd" ] - -# Describe this image -LABEL maintainer="support@vyos.io" \ - description="VyOS for Docker" \ - vendor="Sentrium S.L." \ - version=${VYOS_VERSION} \ - io.vyos.build-date=${BUILD_DATE} \ - org.opencontainers.image.authors="support@vyos.io" \ - org.opencontainers.image.created=${BUILD_DATE} \ - org.opencontainers.image.version=${VYOS_VERSION} \ - org.opencontainers.image.url="https://github.com/vyos/vyos-build" \ - org.opencontainers.image.documentation="https://docs.vyos.io/en/latest/contributing/build-vyos.html" \ - org.opencontainers.image.source="https://github.com/vyos/vyos-build" \ - org.opencontainers.image.vendor="Sentrium S.L." \ - org.opencontainers.image.licenses="GNU" \ - org.opencontainers.image.title="vyos-build" \ - org.opencontainers.image.description="VyOS for Docker" \ - org.opencontainers.image.base.name="docker.io/debian/debian:${DEBIAN_VERSION}-slim" diff --git a/docker-vyos/README.md b/docker-vyos/README.md deleted file mode 100644 index ad0c3881..00000000 --- a/docker-vyos/README.md +++ /dev/null @@ -1,82 +0,0 @@ -# VyOS as Docker container - -VyOS can be run as a Docker container on a Linux host with a compatible kernel. - -## Build Container - -To build a Docker image you need to have the whole `vyos-build` repository, not -only a folder with Dockerfile, because some files from this repository are -required for building. - -Docker image with VyOS can be built on Linux host with the next command: - -```console -docker build --compress --file Dockerfile \ - --tag vyos:version-`date -u +%Y%m%d%H%M%S` \ - --build-arg BUILD_DATE="`date -u --rfc-3339=seconds`" \ - --build-arg VYOS_VERSION=version \ - --build-arg DEBIAN_VERSION=debian \ - --progress plain .. -``` - -Or, if you want to rebuild completely from the scratch (without cache): - -```console -docker build --no-cache --pull --compress --file Dockerfile \ - --tag vyos:version-`date -u +%Y%m%d%H%M%S` \ - --build-arg BUILD_DATE="`date -u --rfc-3339=seconds`" \ - --build-arg VYOS_VERSION=version \ - --build-arg DEBIAN_VERSION=debian \ - --progress plain .. -``` - -> **_NOTE:_** You must use proper version value for `DEBIAN_VERSION` variable. - It can be only `jessie` (for VyOS 1.2) or `buster` (for VyOS 1.3). - -## Run Container - -Docker container with VyOS can be running with the next command: - -```console -docker run --privileged --detach \ - --volume /lib/modules:/lib/modules \ - --name vyos_inside_docker vyos:version -``` - -You need to use the `--privileged` flag because the system actively interacts -with a host kernel to perform routing operations and tune networking options. - -**Experimantal:** You can limit access to some system resources with: - -```console -docker run --privileged --detach \ - --tmpfs /tmp \ - --tmpfs /run \ - --tmpfs /run/lock \ - --volume /lib/modules:/lib/modules:ro \ - --volume /sys/fs/cgroup:/sys/fs/cgroup:ro \ - --name vyos_inside_docker vyos:version -``` - -### Log into container - -To open VyOS CLI, you can use SSH connection to the Docker container or run -on host: - -```console -docker exec -it vyos_inside_docker su vyos -``` - -## Troubleshooting - -If in VyOS appears IPv6-related errors, for example, it cannot assign an IPv6 -address for an interface, it is necessary to enable IPv6 support in Docker. - -This can be done, by editing `/etc/docker/daemon.json`: - -```console -{ - "ipv6": true, - "fixed-cidr-v6": "fe80::/64" -} -``` diff --git a/docker-vyos/vyos_install_common.sh b/docker-vyos/vyos_install_common.sh deleted file mode 100644 index 1fa91d60..00000000 --- a/docker-vyos/vyos_install_common.sh +++ /dev/null @@ -1,96 +0,0 @@ -#!/bin/bash - -# Copyright (C) 2020-2023 VyOS maintainers and contributors -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License version 2 or later as -# published by the Free Software Foundation. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see <http://www.gnu.org/licenses/>. - -# Set environment variables -export DEBIAN_FRONTEND="noninteractive" - -# Prepare for further tasks -function prepare_apt() { - # Update packages list - apt-get update - - # Add VyOS repository to the system - local APT_VYOS_MIRROR=$(tomlq --raw-output .vyos_mirror /tmp/defaults.toml) - local APT_VYOS_BRANCH=$(tomlq --raw-output .vyos_branch /tmp/defaults.toml) - local APT_ADDITIONAL_REPOS=$(tomlq --raw-output .additional_repositories[] /tmp/$(dpkg --print-architecture).toml) - local RELEASE_TRAIN=$(tomlq --raw-output .release_train /tmp/defaults.toml) - - echo "APT_VYOS_MIRROR : $APT_VYOS_MIRROR" - echo "APT_VYOS_BRANCH : $APT_VYOS_BRANCH" - echo "APT_ADDITIONAL_REPOS : $APT_ADDITIONAL_REPOS" - echo "RELEASE_TRAIN : $RELEASE_TRAIN" - - echo -e "deb ${APT_VYOS_MIRROR} ${APT_VYOS_BRANCH} main\n${APT_ADDITIONAL_REPOS}" > /etc/apt/sources.list.d/vyos.list - cat /etc/apt/sources.list.d/vyos.list - - if [ ${RELEASE_TRAIN} == "equuleus" ]; then - # Add backports repository - echo -e "deb http://deb.debian.org/debian buster-backports main\ndeb http://deb.debian.org/debian buster-backports non-free" >> /etc/apt/sources.list.d/vyos.list - fi - - # Copy additional repositories and preferences, if persented - if grep -sq deb /tmp/*.list.chroot; then - cat /tmp/*list.chroot >> /etc/apt/sources.list.d/vyos.list - fi - if grep -sq Package /tmp/*.pref.chroot; then - for pref_file in /tmp/*.pref.chroot; do - cat $pref_file >> /etc/apt/preferences.d/10vyos - echo -e "\n" >> /etc/apt/preferences.d/10vyos - done - fi - - # Add GPG keys - if [[ ! -e /etc/apt/trusted.gpg.d/vyos.gpg ]]; then - echo "Adding GPG keys to the system" - cat /tmp/*.key.chroot | apt-key --keyring /etc/apt/trusted.gpg.d/vyos.gpg add - - fi - - # Update packages list - apt-get -o Acquire::Check-Valid-Until=false update -} - -# Cleanup APT after finish -function cleanup_apt() { - # Clear APT cache - apt-get clean - rm -rf /var/lib/apt/lists/* - rm /etc/apt/sources.list.d/vyos.list - if [[ -e /etc/apt/preferences.d/10vyos ]]; then - rm /etc/apt/preferences.d/10vyos - fi -} - -# Filter list elements -function filter_list() { - local list_elements=("${!1}") - local filtered_elements=("${!2}") - local list_elements_filtered - - for list_element in "${list_elements[@]}"; do - local filtered="" - - for filtered_element in "${filtered_elements[@]}"; do - if [[ ${list_element} =~ ${filtered_element} ]]; then - filtered=True - fi - done - - if [[ -z "${filtered}" ]]; then - list_elements_filtered+=("${list_element}") - fi - done - echo ${list_elements_filtered[@]} -} diff --git a/docker-vyos/vyos_install_stage_01.sh b/docker-vyos/vyos_install_stage_01.sh deleted file mode 100644 index 42e8d1c8..00000000 --- a/docker-vyos/vyos_install_stage_01.sh +++ /dev/null @@ -1,105 +0,0 @@ -#!/bin/bash - -# Copyright (C) 2020-2023 VyOS maintainers and contributors -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License version 2 or later as -# published by the Free Software Foundation. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see <http://www.gnu.org/licenses/>. - -# Stage 1 - install dependencies - -# load common functions -. vyos_install_common.sh - -echo "Configuring APT repositories" -prepare_apt - -# Get list of VyOS packages -vyos_packages=( - "vyos-1x" - ) - -# Do not analyze packages, which we do not need in Docker -vyos_packages_filter=( - "vyos-intel*" - ) -vyos_packages_filtered=("$(filter_list vyos_packages[@] vyos_packages_filter[@])") -echo "Packages for dependency analyzing: ${vyos_packages_filtered[@]}" - -# Get list of all dependencies -vyos_dependencies=(`apt-get -s install --no-install-recommends ${vyos_packages_filtered[@]} | awk '/Inst/ { printf("%s ", $2) }'`) - -# Do not install unnecessary -ignore_list=( - "dosfstools" - "parted" - "libparted*" - "efibootmgr" - "gdisk" - "grub-*" - "laptop-detect" - "installation-report" - "tshark" - "wireshark*" - "mdadm" - "keepalived" - "libheartbeat2" - "bmon" - "crda" - "ipvsadm" - "iw" - "pptpd" - "cluster-glue" - "resource-agents" - "heartbeat" - "podman" - ) - -# Get list of packages from VYOS repository -if ls /var/lib/apt/lists/*vyos*Packages* | grep -q gz$; then - arch_cat="zcat" -fi -if ls /var/lib/apt/lists/*vyos*Packages* | grep -q lz4$; then - arch_cat="lz4cat" - echo "Installing lz4" - apt-get install -y --no-install-recommends lz4 -fi -vyos_repo_packages=(`$arch_cat /var/lib/apt/lists/*vyos*Packages* | awk '/Package:/ { printf("%s\n",$2) }'`) -if [[ "${arch_cat}" == "lz4cat" ]]; then - echo "Removing lz4" - apt-get purge -y lz4 -fi -# Add them to ignore list - we do not need anything from VyOS in this layer of image -ignore_list=("${ignore_list[@]}" "${vyos_repo_packages[@]}") - -# Remove every ignore list item from installation list -vyos_dependencies_filtered=("$(filter_list vyos_dependencies[@] ignore_list[@])") - -# Add missed dependencies -vyos_dependencies_filtered+=( - "liburi-perl" - "locales" - "libcap-ng0" - "libnss-myhostname" - "dbus" - ) - -echo "Dependencies filtered list: ${vyos_dependencies_filtered[@]}" - -# Install delependencies -echo "Installing dependencies" -apt-get install -y --no-install-recommends ${vyos_dependencies_filtered[@]} - -echo "Deconfiguring APT repositories" -cleanup_apt - - -exit 0 diff --git a/docker-vyos/vyos_install_stage_02.sh b/docker-vyos/vyos_install_stage_02.sh deleted file mode 100644 index 58a62a8d..00000000 --- a/docker-vyos/vyos_install_stage_02.sh +++ /dev/null @@ -1,65 +0,0 @@ -#!/bin/bash - -# Copyright (C) 2020-2023 VyOS maintainers and contributors -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License version 2 or later as -# published by the Free Software Foundation. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see <http://www.gnu.org/licenses/>. - -# Stage 2 - install VyOS packages - -# load common functions -. vyos_install_common.sh - -echo "Configuring APT repositories" -prepare_apt - -# Get list of VyOS packages -vyos_packages=( - "vyos-1x" - ) - -# Do not analyze packages, which we do not need in Docker -vyos_packages_filter=( - "vyos-intel*" - ) -vyos_packages_filtered=("$(filter_list vyos_packages[@] vyos_packages_filter[@])") - -# Add missed dependencies -vyos_packages_filtered+=( - "uuid" - "jq" - "yq" - "systemd" - ) - -echo "Packages for installing: ${vyos_packages_filtered[@]}" -# Install VyOS packages -echo "Installing VyOS packages" -apt-get install -y --no-install-recommends ${vyos_packages_filtered[@]} - -# Create VyOS version file -RELEASAE_TRAIN=$(tomlq --raw-output .release_train /tmp/defaults.toml) -apt-cache show vyos-1x | awk -v release_train=${RELEASAE_TRAIN} '{ if ($1 == "Version:") version = $2 } END { build_git = "unknown" ; built_by = "Sentrium S.L." ; built_on = strftime("%F %T UTC", systime(), utc) ; "uuid -v 4" | getline build_uuid ; printf("{\"version\": \"%s\", \"build_git\": \"%s\", \"built_on\": \"%s\", \"built_by\": \"%s\", \"build_uuid\": \"%s\", \"release_train\": \"%s\"}", version, build_git, built_on, built_by, build_uuid, release_train) }' | json_pp > /usr/share/vyos/version.json - -# Delete what we do not need inside Docker image (this step makes packages database inconsistent) -echo "Deleting what is needless in containers" -dpkg -P --force-depends dosfstools efibootmgr yq jq gdisk grub-common grub-efi-amd64-bin initscripts installation-report laptop-detect libossp-uuid16 libparted2 libwireshark-data libwireshark5 mdadm parted tshark uuid -dpkg -l | awk '/linux-image-/ { system("dpkg -P --force-depends " $2) }' - -# Delete documentation -rm -rf /usr/share/doc /usr/share/doc-base - -echo "Deconfiguring APT repositories" -cleanup_apt - - -exit 0 diff --git a/docker-vyos/vyos_install_stage_03.sh b/docker-vyos/vyos_install_stage_03.sh deleted file mode 100644 index e51ff089..00000000 --- a/docker-vyos/vyos_install_stage_03.sh +++ /dev/null @@ -1,63 +0,0 @@ -#!/bin/bash - -# Copyright (C) 2020-2023 VyOS maintainers and contributors -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License version 2 or later as -# published by the Free Software Foundation. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see <http://www.gnu.org/licenses/>. - -# Stage 3 - tune the system - -# load common functions -. vyos_install_common.sh - -# Add config partition marker -mkdir -p /opt/vyatta/etc/config -touch /opt/vyatta/etc/config/.vyatta_config - -# create folder for configuration mounting -ln -s /opt/vyatta/etc/config /config - -# Delete SSH keys -rm -rf /etc/ssh/ssh_host_* - -# Fix FUSE settings -sed -i 's/#user_allow_other/user_allow_other/g' /etc/fuse.conf - -# Configure locale -sed -i 's/# en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/g' /etc/locale.gen -dpkg-reconfigure locales -update-locale LANG=en_US.UTF-8 LC_ALL=C - -# Tune bash and environment settings -echo "source /etc/bash_completion" >> /root/.bashrc -sed -i 's/set $BASH_COMPLETION_ORIGINAL_V_VALUE/builtin set $BASH_COMPLETION_ORIGINAL_V_VALUE/g' /usr/share/bash-completion/bash_completion - -# Run configuration hooks -echo "Running system configuration hooks" -hooks_list=( - "18-enable-disable_services.chroot" - "30-frr-configs.chroot" - ) -for hook in ${hooks_list[@]}; do - if [[ -e /tmp/hooks/${hook} ]]; then - echo "Running ${hook}" - /tmp/hooks/${hook} - fi -done - -# Delete needless options from CLI - CLI_DELETION=( - "/opt/vyatta/share/vyatta-cfg/templates/container/" - ) - rm -rf ${CLI_DELETION[@]} - -exit 0 |
