Docker Community Forums

Share and learn in the Docker community.

How to run/test DPDK in Docker's container?


(Quanta99061418) #1

Hi, Everyone

I have a couple of questions:

  1. We used these standard option run DPDK in QEMU:
    -chardev socket,id=char1,path=/usr/bin/usvhost-1\
    -netdev type=vhost-user,id=mynet1,chardev=char1\
    -device virtio-net-pci,mac==x1:x2:x3:x4:x5:x6,netdev=mynet1,id=net1,csum=off,gso=off,guest_csum=off,guest_tso4=off,guest_tso6=off,guest_ecn=off &

How to 1 on 1 mapping and correct run in container? what is these docker command? My targets:
(1) The docker’s all application can transmit/ receive in container’s interface(eth0).
(2) The container’s interface/IP can connect to outside PC when the DPDK is running.

  1. Here is dockerfile.

FROM ubuntu:16.04
RUN sed -i 's/# (.multiverse$)/\1/g’ /etc/apt/sources.list &&
apt-get update
&& apt-get -y upgrade
&& apt-get install -y
&& rm -rf /var/lib/apt/lists/

RUN mkdir /mnt/huge-1048576kB > /dev/null
COPY dpdk-stable-16.07.2 /root/dpdk/.
ENV HOME /root
ENV RTE_SDK /root/sw_package/dpdk-stable-16.07.2
ENV RTE_TARGET=x86_64-native-linuxapp-gcc
WORKDIR /root/dpdk/x86_64-native-linuxapp-gcc/app
CMD ["/bin/bash"]

  1. Start a container instance with a virtio-user port.

docker run -it
-v /usr/bin/usvhost-1:/var/run/usvhost
-v /mnt/huge-1048576kB:/mnt/huge-1048576kB
–privileged --name container1 ubuntu:16.04 /bin/bash

  1. Run the testpmd and testing.
    mount -t hugetlbfs nodev /mnt/huge-1048576kB

./testpmd -l 2-3 -n 2 -m 1024
–huge-dir /mnt/huge-1048576kB
–file-prefix=usvhost1 – -i
–txqflags=0xf00 --disable-hw-vlan

  1. Test Environment: PC <-> Host <-> container(It has DPDK function).
    How to the PC side can ping to container’s IP?

I appreciate your help in clarifying this.

(David Maze) #2

If you need an extremely detailed, extremely specialized network topology, Docker is the wrong technology. Docker is great for proxying simple TCP services, but for the sort of testing you’re describing you need to hand-write very detailed iptables rules; having Docker involved probably makes this harder if anything.

(Quanta99061418) #3

Hi, David

Thank you for your reply. We only one rule “iptables -I INPUT 1 -i virbr0 -p tcp --dport 8080 -j ACCEPT” for iptables rule.

I’d appreciate your help.