diff options
author | Robert Göhler <github@ghlr.de> | 2021-12-10 19:31:09 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-12-10 19:31:09 +0100 |
commit | dfaa60db25015436317c8f855bee0e8a46266c7f (patch) | |
tree | df0516a3efe4dc87f1c32730299d7fb40f74c339 /docs/installation/virtual/docker.rst | |
parent | d30f8c0f58a5086aef61f6259f74192021a03c6e (diff) | |
parent | ad57b2940aa20bc9ea7d64b7277441ba65e42e2a (diff) | |
download | vyos-documentation-dfaa60db25015436317c8f855bee0e8a46266c7f.tar.gz vyos-documentation-dfaa60db25015436317c8f855bee0e8a46266c7f.zip |
Merge pull request #670 from jeffbrl/installing-vyos-docker
Add docker installation guide
Diffstat (limited to 'docs/installation/virtual/docker.rst')
-rw-r--r-- | docs/installation/virtual/docker.rst | 74 |
1 files changed, 74 insertions, 0 deletions
diff --git a/docs/installation/virtual/docker.rst b/docs/installation/virtual/docker.rst new file mode 100644 index 00000000..e2bc0198 --- /dev/null +++ b/docs/installation/virtual/docker.rst @@ -0,0 +1,74 @@ +.. _docker: + +*************************** +Running in Docker Container +*************************** + +Docker is an open-source project for deploying applications as standardized +units called containers. Deploying VyOS in a container provides a simple and +lightweight mechanism for both testing and packet routing for container +workloads. + +IPv6 Support for docker +======================= + +VyOS requires an IPv6-enabled docker network. Currently linux distributions +do not enable docker IPv6 support by default. You can enable IPv6 support in +two ways. + +Method 1: Create a docker network with IPv6 support +--------------------------------------------------- + +Here is a example using the macvlan driver. + +.. code-block:: none + + docker network create --ipv6 -d macvlan -o parent=eth0 --subnet 2001:db8::/64 --subnet 192.0.2.0/24 mynet + +Method 2: Add IPv6 support to the docker daemon +----------------------------------------------- + +Edit /etc/docker/daemon.json to set the ``ipv6`` key to ``true`` and to specify +the ``fixed-cidr-v6`` to your desired IPv6 subnet. + +.. code-block:: none + + { + "ipv6": true, + "fixed-cidr-v6": "2001:db8::/64" + } + +Reload the docker configuration. + +.. code-block:: none + + $ sudo systemctl reload docker + + +Deploy container from ISO +========================= + +Download the ISO on which you want to base the container. In this example, +the name of the ISO is ``vyos-1.4-rolling-202111281249-amd64.iso``. If you +created a custom IPv6-enabled network, the ``docker run`` command below +will require that this network be included as the ``--net`` parameter to +``docker run``. + +.. code-block:: none + + $ mkdir vyos && cd vyos + $ cp ~/vyos-1.4-rolling-202111281249-amd64.iso . + $ mkdir rootfs + $ sudo mount -o loop vyos-1.4-rolling-202111281249-amd64.iso rootfs + $ sudo apt-get install -y squashfs-tools + $ mkdir unsquashfs + $ sudo unsquashfs -f -d unsquashfs/ rootfs/live/filesystem.squashfs + $ sudo tar -C unsquashfs -c . | docker import - vyos:1.4-rolling-202111281249 + $ sudo umount rootfs + $ cd .. + $ sudo rm -rf vyos + $ docker run -d --rm --name vyos --privileged -v /lib/modules:/lib/modules \ + > vyos:1.4-rolling-202111281249 /sbin/init + $ docker exec -ti vyos su - vyos + +You can execute ``docker stop vyos`` when you are finished with the container. |