diff options
author | zsdc <taras@vyos.io> | 2020-06-24 21:27:58 +0300 |
---|---|---|
committer | zsdc <taras@vyos.io> | 2020-06-25 14:57:16 +0300 |
commit | ebc80decd21a448de58cc7e551e98949e96113d0 (patch) | |
tree | dfa0a4996c98072204609b9472a8ce3ec16718a8 /docker-vyos/README.md | |
parent | 488ebdf6ca0de558dbbadcab1342f7625aa3a588 (diff) | |
download | vyos-build-ebc80decd21a448de58cc7e551e98949e96113d0.tar.gz vyos-build-ebc80decd21a448de58cc7e551e98949e96113d0.zip |
Docker: T2640: Added ability to build Docker images with VyOS
This implementation works, but it is on the proof-of-concept stage and requires extended testing.
Diffstat (limited to 'docker-vyos/README.md')
-rw-r--r-- | docker-vyos/README.md | 59 |
1 files changed, 59 insertions, 0 deletions
diff --git a/docker-vyos/README.md b/docker-vyos/README.md new file mode 100644 index 00000000..7c1fb6a1 --- /dev/null +++ b/docker-vyos/README.md @@ -0,0 +1,59 @@ +# VyOS as Docker container + +VyOS can be run as a Docker container on a Linux host with a compatible kernel. + + +## Building Docker image + +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: + +``` +docker build --compress -f Dockerfile -t 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): + +``` +docker build --no-cache --pull --compress -f Dockerfile -t 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). + +## Running Docker image + +Docker container with VyOS can be running with the next command: + +``` +docker run -v /lib/modules:/lib/modules --privileged --name vyos_inside_docker -d 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: + +``` +docker run --tmpfs /tmp --tmpfs /run --tmpfs /run/lock -v /sys/fs/cgroup:/sys/fs/cgroup:ro -v /lib/modules:/lib/modules --privileged --name vyos_inside_docker -d vyos:version +``` + +## Logging into a VyOS container + +To open VyOS CLI, you can use SSH connection to the Docker container or run on host: + +``` +docker exec -it vyos_inside_docker su vyos +``` + + +## Troubleshooting + +If in VyOS appears IPv6-related errors, for example, it cannot assign an IPv6 for an interface, it is necessary to enable IPv6 support in Docker. This can be done, by editing `/etc/docker/daemon.json`: + +``` +{ + "ipv6": true, + "fixed-cidr-v6": "fe80::/64" +} + +``` |