KatharaFramework / Docker-Images

Dockerfiles and scripts to build Kathará Docker images.
https://www.kathara.org/
GNU General Public License v3.0
22 stars 9 forks source link

image request: P4 + FRR #4

Closed zhangineer2 closed 2 years ago

zhangineer2 commented 2 years ago

Hello

can you help build an image that contains both P4 and FRR ?

Thank you

Skazza94 commented 2 years ago

Hi @zhangineer, the simplest way to achieve what you want is to create an empty Dockerfile, and use kathara/p4 as base image (since building bmv2 from source code requires a lot of time). Then, you install the content of the kathara/frr image inside it.

The result should be the following:

FROM kathara/p4:debian10

RUN curl -s https://deb.frrouting.org/frr/keys.asc | apt-key add -   
RUN echo deb https://deb.frrouting.org/frr $(lsb_release -s -c) "frr-7" | tee -a /etc/apt/sources.list.d/frr.list 
RUN apt update && DEBIAN_FRONTEND=noninteractive apt install -y frr frr-pythontools

RUN sed -i -e 's/service/no service/' /etc/frr/vtysh.conf \
    && rm /etc/frr/frr.conf

RUN apt clean && \
    rm -rf /tmp/* /var/lib/apt/lists/* /var/tmp/*

After saving this file, open a terminal in the same folder where the Dockerfile is located and run: docker build -t <IMAGE_NAME> .

<IMAGE_NAME> is a tag (name) that you assign to the image. For example, let's call it frr-p4: docker build -t frr-p4 .

When the image is built, you can use it in a lab.conf file as follows:

pc1[0]="A"
pc1[image]="frr-p4"
zhangineer2 commented 2 years ago

Thank you @Skazza94 for the detailed reply and instructions! Much appreciated!!