Virtio_user for Container Networking

 

 

7.2. Sample Usage

Here we use Docker as container engine. It also applies to LXC, Rocket with some minor changes.

  1. Write a Dockerfile like below.

    cat <<EOT >> Dockerfile
    FROM ubuntu:latest
    WORKDIR /usr/src/dpdk
    COPY . /usr/src/dpdk
    ENV PATH "$PATH:/usr/src/dpdk/<build_dir>/app/"
    EOT
    
  2. Build a Docker image.

    docker build -t dpdk-app-testpmd .
    
  3. Start a testpmd on the host with a vhost-user port.

    $(testpmd) -l 0-1 -n 4 --socket-mem 1024,1024 \
        --vdev 'eth_vhost0,iface=/tmp/sock0' \
        --file-prefix=host --no-pci -- -i
    
  4. Start a container instance with a virtio-user port.

    docker run -i -t -v /tmp/sock0:/var/run/usvhost \
        -v /dev/hugepages:/dev/hugepages \
        dpdk-app-testpmd testpmd -l 6-7 -n 4 -m 1024 --no-pci \
        --vdev=virtio_user0,path=/var/run/usvhost \
        --file-prefix=container \
        -- -i
    

Note: If we run all above setup on the host, it’s a shm-based IPC.

上一篇:dpdk mempool debug


下一篇:五分钟看懂抓包神技:DPDK