DPDK in docker
[ DPDK install on Host ]
## http://dpdk.org/doc/guides/linux_gsg/build_dpdk.html
## http://dannykim.me/danny/openflow/86417
## https://github.com/bisdn/dpdk-dev/blob/master/tools/setup.sh
## High Precision Timer(HPET) set 확인
$ grep hpet /proc/timer_list
## hugepage 세팅
# echo 256 > /sys/kernel/mm/hugepages/hugepages-2048kB/nr_hugepages
## Using Hugepages with the DPDK
# mkdir -p /mnt/huge
# mount -t hugetlbfs nodev /mnt/huge
# vi /etc/fstab
nodev /mnt/huge hugetlbfs defaults 0 0
## dpdk download
## http://dpdk.org/browse/dpdk/
$ mkdir -p dpdk && cd dpdk
$ curl -OL http://dpdk.org/browse/dpdk/snapshot/dpdk-16.04.tar.gz
$ tar xzvf dpdk-16.04.tar.gz
$ cd dpdk-16.04
## Installation of DPDK Target Environments
$ sudo yum update
$ sudo yum install -y sudo gcc libhugetlbfs-utils libpcap-devel \
kernel kernel-devel kernel-headers
$ make config T=x86_64-native-linuxapp-gcc
$ make
## Loading Modules to Enable Userspace IO for DPDK
$ sudo modprobe uio_pci_generic
$ sudo insmod build/kmod/igb_uio.ko
$ lsmod | grep igb_uio
## Loading VFIO Module
$ sudo modprobe vfio-pci
$ vi ~/.bashrc
export RTE_SDK=$HOME/dpdk/dpdk-16.04
export RTE_TARGET=build
$ source ~/.bashrc
$ env | grep RTE
$ cd examples/helloworld
$ make
$ cd build/app
$ sudo ./helloworld -c 3 -n 3
[ DPDK install in docker ]
## Host 에 미리 세팅
## hugepage 세팅
# echo 256 > /sys/kernel/mm/hugepages/hugepages-2048kB/nr_hugepages
## Using Hugepages with the DPDK
# mkdir -p /mnt/huge
# mount -t hugetlbfs nodev /mnt/huge
# vi /etc/fstab
nodev /mnt/huge hugetlbfs defaults 0 0
$ mkdir -p github
$ cd github
$ git clone https://github.com/seungkyua/dpdk-docker-helloworld.git
$ cd dpdk-docker-helloworld
$ cp -R /lib/modules .
$ cp -R /usr/src/kernels/ .
$ vi Dockerfile
FROM centos:7.2.1511
MAINTAINER Seungkyu Ahn <seungkyua@gmail.com>
ENV REFRESHED_AT 2016-07-13
LABEL docker run --rm -it --privileged \
-v /sys/bus/pci/devices:/sys/bus/pci/devices \
-v /sys/kernel/mm/hugepages:/sys/kernel/mm/hugepages \
-v /sys/devices/system/node:/sys/devices/system/node \
-v /dev:/dev \
-v /mnt/huge:/mnt/huge \
--name dpdk-docker dpdk-docker-helloworld
ENV DPDK_VERSION=16.04
ENV RTE_SDK=/root/dpdk-${DPDK_VERSION}
ENV RTE_TARGET=build
USER root
# yum update
RUN yum -y update
RUN yum install -y deltarpm gcc make libhugetlbfs-utils libpcap-devel; yum clean all
RUN yum install -y kernel kernel-devel kernel-headers; yum clean all
# dpdk download
COPY modules /lib/modules
COPY kernels /usr/src/kernels
WORKDIR /root
RUN curl -OL http://dpdk.org/browse/dpdk/snapshot/dpdk-${DPDK_VERSION}.tar.gz
RUN tar xzf dpdk-${DPDK_VERSION}.tar.gz
WORKDIR /root/dpdk-${DPDK_VERSION}
RUN make config T=x86_64-native-linuxapp-gcc
RUN make
# Loading Modules to Enable Userspace IO for DPDK
RUN modprobe uio_pci_generic
RUN modprobe vfio-pci
WORKDIR examples/helloworld
RUN make
WORKDIR build/app
ENTRYPOINT [ "./helloworld" ]
CMD [ "-c", " 3", "-n", "3" ]
$ docker build -t dpdk-docker-helloworld .
$ docker run --rm -it --privileged \
-v /sys/bus/pci/devices:/sys/bus/pci/devices \
-v /sys/kernel/mm/hugepages:/sys/kernel/mm/hugepages \
-v /sys/devices/system/node:/sys/devices/system/node \
-v /dev:/dev \
-v /mnt/huge:/mnt/huge \
--name dpdk-docker dpdk-docker-helloworld
## 에러 날 때 패키지 찾아서 설치
yum provides '*/applydeltarpm'
yum install deltarpm
## 아래 패키지 에러 날 때 해결책
Rpmdb checksum is invalid: dCDPT(pkg checksums): perl-HTTP-Tiny.noarch 0:0.033-3.el7 - u
$ sudo yum provides '*/perl-HTTP-Tiny'