4 This page covers how to build FRR Docker images.
8 FRR has Docker build infrastructure to produce Docker images containing
9 source-built FRR on the following base platforms:
15 The following platform images are used to support Travis CI and can also
16 be used to reproduce topotest failures when the docker host is Ubuntu
17 (tested on 18.04 and 20.04):
22 The following platform images may also be built, but these simply install a
23 binary package from an existing repository and do not perform source builds:
27 Some of these are available on `DockerHub
28 <https://hub.docker.com/repository/docker/frrouting/frr/tags?page=1>`_.
30 There is no guarantee on what is and is not available from DockerHub at time of
36 Some platforms contain an included build script that may be run from the host.
37 This will set appropriate packaging environment variables and clean up
38 intermediate build images.
40 These scripts serve another purpose. They allow building platform packages
41 without needing the platform. For example, the Centos 8 docker image can also
42 be leveraged to build Centos 8 RPMs that can then be used separately from
45 If you are only interested in the Docker images and don't want the cleanup
46 functionality of the scripts you can ignore them and perform a normal Docker
47 build. If you want to build multi-arch docker images this is required as the
48 scripts do not support using Buildkit for multi-arch builds.
55 ./docker/alpine/build.sh
59 docker build -f docker/alpine/Dockerfile .
61 No script, multi-arch (ex. amd64, arm64, armv7)::
63 docker buildx build --platform linux/amd64,linux/arm64,linux/arm/v7 -f docker/alpine/Dockerfile -t frr:latest .
74 Multi-arch (ex. amd64, arm64, armv7)::
77 docker buildx build --platform linux/amd64,linux/arm64,linux/arm/v7 -t frr-debian:latest .
79 Building Centos 7 Image
80 -----------------------
84 ./docker/centos-7/build.sh
88 docker build -f docker/centos-7/Dockerfile .
90 No script, multi-arch (ex. amd64, arm64)::
92 docker buildx build --platform linux/amd64,linux/arm64 -f docker/centos-7/Dockerfile -t frr-centos7:latest .
95 Building Centos 8 Image
96 -----------------------
100 ./docker/centos-8/build.sh
104 docker build -f docker/centos-8/Dockerfile .
106 No script, multi-arch (ex. amd64, arm64)::
108 docker buildx build --platform linux/amd64,linux/arm64 -f docker/centos-8/Dockerfile -t frr-centos8:latest .
113 -----------------------
117 ./docker/ubi-8/build.sh
119 Script with params, an example could be this (all that info will go to docker label) ::
121 ./docker/ubi-8/build.sh frr:ubi-8-my-test "$(git rev-parse --short=10 HEAD)" my_release my_name my_vendor
125 docker build -f docker/ubi-8/Dockerfile .
127 No script, multi-arch (ex. amd64, arm64)::
129 docker buildx build --platform linux/amd64,linux/arm64 -f docker/ubi-8/Dockerfile -t frr-ubi-8:latest .
133 Building Ubuntu 18.04 Image
134 ---------------------------
136 Build image (from project root directory)::
138 docker build -t frr-ubuntu18:latest -f docker/ubuntu18-ci/Dockerfile .
140 Start the container::
142 docker run -d --privileged --name frr-ubuntu18 --mount type=bind,source=/lib/modules,target=/lib/modules frr-ubuntu18:latest
144 Running a topotest (when the docker host is Ubuntu)::
146 docker exec frr-ubuntu18 bash -c 'cd ~/frr/tests/topotests/ospf-topo1 ; sudo pytest test_ospf_topo1.py'
148 Starting an interactive bash session::
150 docker exec -it frr-ubuntu18 bash
152 Stopping an removing a container::
154 docker stop frr-ubuntu18 ; docker rm frr-ubuntu18
156 Removing the built image::
158 docker rmi frr-ubuntu18:latest
161 Building Ubuntu 20.04 Image
162 ---------------------------
164 Build image (from project root directory)::
166 docker build -t frr-ubuntu20:latest -f docker/ubuntu20-ci/Dockerfile .
168 Start the container::
170 docker run -d --privileged --name frr-ubuntu20 --mount type=bind,source=/lib/modules,target=/lib/modules frr-ubuntu20:latest
172 Running a topotest (when the docker host is Ubuntu)::
174 docker exec frr-ubuntu20 bash -c 'cd ~/frr/tests/topotests/ospf-topo1 ; sudo pytest test_ospf_topo1.py'
176 Starting an interactive bash session::
178 docker exec -it frr-ubuntu20 bash
180 Stopping an removing a container::
182 docker stop frr-ubuntu20 ; docker rm frr-ubuntu20
184 Removing the built image::
186 docker rmi frr-ubuntu20:latest