[v5] build: add dockerfile for building docker image
diff mbox series

Message ID 1575986121-366042-1-git-send-email-abdul.halim@intel.com
State Superseded
Delegated to: David Marchand
Headers show
Series
  • [v5] build: add dockerfile for building docker image
Related show

Checks

Context Check Description
ci/iol-mellanox-Performance success Performance Testing PASS
ci/iol-testing success Testing PASS
ci/iol-intel-Performance success Performance Testing PASS
ci/travis-robot warning Travis build: failed
ci/Intel-compilation success Compilation OK
ci/checkpatch success coding style OK

Commit Message

Abdul Halim Dec. 10, 2019, 1:55 p.m. UTC
Adding a Dockerfile with Ubuntu bionic base image to build dpdk as shared
library. This docker image could be used as base image to build and run
dpdk applications in containers.

Signed-off-by: Abdul Halim <abdul.halim@intel.com>

---

v2:
  * renamed Dockerfile name from Dockerfile.ubuntu to Dockerfile.bionic
  * added call to ldconfig to update cache of libraries to include newly
    installed DPDK libs

---

v3:
  * added example use-case of dpdk dockerfile in extras/README.md

---
v4:
  * changed meson build to use tmp dir in docker build
  * changed sample app dockerfile to add only helloworld source code

---
v5:
  * fix whitespace error
---
 extras/Dockerfile.bionic | 40 +++++++++++++++++++++++++++++++++++++
 extras/README.md         | 51 ++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 91 insertions(+)
 create mode 100644 extras/Dockerfile.bionic
 create mode 100644 extras/README.md

Comments

Ray Kinsella Dec. 10, 2019, 5:44 p.m. UTC | #1
On 10/12/2019 13:55, Abdul Halim wrote:
> Adding a Dockerfile with Ubuntu bionic base image to build dpdk as shared
> library. This docker image could be used as base image to build and run
> dpdk applications in containers.
> 
> Signed-off-by: Abdul Halim <abdul.halim@intel.com>
> 
> ---
> 
> v2:
>   * renamed Dockerfile name from Dockerfile.ubuntu to Dockerfile.bionic
>   * added call to ldconfig to update cache of libraries to include newly
>     installed DPDK libs
> 
> ---
> 
> v3:
>   * added example use-case of dpdk dockerfile in extras/README.md
> 
> ---
> v4:
>   * changed meson build to use tmp dir in docker build
>   * changed sample app dockerfile to add only helloworld source code
> 
> ---
> v5:
>   * fix whitespace error
> ---
>  extras/Dockerfile.bionic | 40 +++++++++++++++++++++++++++++++++++++
>  extras/README.md         | 51 ++++++++++++++++++++++++++++++++++++++++++++++++
>  2 files changed, 91 insertions(+)
>  create mode 100644 extras/Dockerfile.bionic
>  create mode 100644 extras/README.md
> 
> diff --git a/extras/Dockerfile.bionic b/extras/Dockerfile.bionic
> new file mode 100644
> index 0000000..cf9c176
> --- /dev/null
> +++ b/extras/Dockerfile.bionic
> @@ -0,0 +1,40 @@
> +# SPDX-License-Identifier: BSD-3-Clause
> +# Copyright(c) 2019 Intel Corporation
> +FROM ubuntu:bionic
> +
> +# install requirements for getting and building DPDK
> +# including dependencies for DPDK features
> +RUN apt-get update && apt-get install -y \
> +    build-essential \
> +    pkg-config \
> +    python3 \
> +    python3-pip \
> +    ninja-build \
> +    libjansson-dev \
> +    libbsd-dev \
> +    libnuma-dev \
> +    libssl-dev \
> +    zlib1g-dev \
> +    libpcap-dev \
> +    libibverbs-dev \
> +        && pip3 install meson \
> +        && apt-get clean && rm -rf /var/lib/apt/lists/*
> +
> +ADD . /tmp/dpdk
> +
> +WORKDIR /tmp/dpdk
> +
> +RUN meson /tmp/dpdk-build \
> +    -Ddefault_library=shared \
> +    -Dmachine=default \
> +    -Dper_library_versions=false \
> +        && ninja -C /tmp/dpdk-build install \
> +        && ldconfig \
> +        && cd /; rm -rf /tmp/dpdk
> +
> +WORKDIR /
> +
> +# Installed DPDK Shared library location:
> +# lib dir : /usr/local/lib/
> +# include : /usr/local/include/
> +# pkgconfig file: /usr/local/lib/x86_64-linux-gnu/pkgconfig/libdpdk.pc
> diff --git a/extras/README.md b/extras/README.md
> new file mode 100644
> index 0000000..8001012
> --- /dev/null
> +++ b/extras/README.md
> @@ -0,0 +1,51 @@
> +# Build DPDK Docker image
> +
> +To build a docker image run the following command from dpdk root directory.
> +
> +```
> +DOCKER_TAG="dpdk"
> +docker build -t ${DOCKER_TAG} -f extras/Dockerfile.bionic .
> +```
> +
> +# Example of how to use this dpdk library image
> +
> +The following steps shows how to use the dpdk shared library container to build
> +and run a dpdk application without having to build dpdk library for each
> +application.
> +
> +## Create a dpdk sample app docker file with 'dpdk' as the base image
> +
> +Create a docker file to build the helloworld application from example/helloworld
> +source files in dpdk root directory.
> +
> +```
> +cat << EOF > Dockerfile.dpdkSampleApp
> +FROM dpdk
> +
> +ADD examples/helloworld /opt/examples/helloworld
> +
> +WORKDIR /opt/examples/helloworld
> +RUN make && cp build/helloworld-shared /usr/local/bin/helloworld
> +EOF
> +```
> +
> +## Build sample app docker image
> +
> +```
> +DOCKERAPP_TAG="dpdk-helloworld"
> +docker build -t ${DOCKERAPP_TAG} -f Dockerfile.dpdkSampleApp .
> +```
> +
> +This sample app now can be run like any other applicaiton in a docker container.
> +
> +```
> +$ docker run --rm --privileged -it  -v /dev/hugepages:/dev/hugepages dpdk-helloworld
> +```
> +
> +## Running the sample app
> +Once inside the container run helloword binary
> +
> +```
> +$ root@11233ed2e69c # helloworld
> +```
> +
> 

Hi Abdul,

Other's feel free to shoot me down. 
But I am not sure that HelloWorld is really the example we want to show here.

HelloWorld is good and it minimizes the associated config you need to describe.
However does it really help a someone get started running DPDK in a container, as there is no network interface. 

Is there anyway we could show something running on a network interface?
Perhaps we contrive something simple with vEth, AF_Packet and TestPMD?

Ray K
Ruifeng Wang Dec. 11, 2019, 6:45 a.m. UTC | #2
> -----Original Message-----
> From: Abdul Halim <abdul.halim@intel.com>
> Sent: Tuesday, December 10, 2019 21:55
> To: dev@dpdk.org
> Cc: ray.kinsella@intel.com; yasufum.o@gmail.com; Ruifeng Wang (Arm
> Technology China) <Ruifeng.Wang@arm.com>; Abdul Halim
> <abdul.halim@intel.com>
> Subject: [PATCH v5] build: add dockerfile for building docker image
> 
> Adding a Dockerfile with Ubuntu bionic base image to build dpdk as shared
> library. This docker image could be used as base image to build and run dpdk
> applications in containers.
> 
> Signed-off-by: Abdul Halim <abdul.halim@intel.com>
> 
> ---
> 
> v2:
>   * renamed Dockerfile name from Dockerfile.ubuntu to Dockerfile.bionic
>   * added call to ldconfig to update cache of libraries to include newly
>     installed DPDK libs
> 
> ---
> 
> v3:
>   * added example use-case of dpdk dockerfile in extras/README.md
> 
> ---
> v4:
>   * changed meson build to use tmp dir in docker build
>   * changed sample app dockerfile to add only helloworld source code
> 
> ---
> v5:
>   * fix whitespace error
> ---
>  extras/Dockerfile.bionic | 40
> +++++++++++++++++++++++++++++++++++++
>  extras/README.md         | 51
> ++++++++++++++++++++++++++++++++++++++++++++++++
>  2 files changed, 91 insertions(+)
>  create mode 100644 extras/Dockerfile.bionic  create mode 100644
> extras/README.md
> 
> diff --git a/extras/Dockerfile.bionic b/extras/Dockerfile.bionic new file mode
> 100644 index 0000000..cf9c176
> --- /dev/null
> +++ b/extras/Dockerfile.bionic
> @@ -0,0 +1,40 @@
> +# SPDX-License-Identifier: BSD-3-Clause # Copyright(c) 2019 Intel
> +Corporation FROM ubuntu:bionic
> +
> +# install requirements for getting and building DPDK # including
> +dependencies for DPDK features RUN apt-get update && apt-get install -y
> +\
> +    build-essential \
> +    pkg-config \
> +    python3 \
> +    python3-pip \
> +    ninja-build \
> +    libjansson-dev \
> +    libbsd-dev \
> +    libnuma-dev \
> +    libssl-dev \
> +    zlib1g-dev \
> +    libpcap-dev \
> +    libibverbs-dev \
> +        && pip3 install meson \
> +        && apt-get clean && rm -rf /var/lib/apt/lists/*
> +
> +ADD . /tmp/dpdk
> +
> +WORKDIR /tmp/dpdk
> +
> +RUN meson /tmp/dpdk-build \
> +    -Ddefault_library=shared \
> +    -Dmachine=default \
> +    -Dper_library_versions=false \
> +        && ninja -C /tmp/dpdk-build install \
> +        && ldconfig \
> +        && cd /; rm -rf /tmp/dpdk

You may want to rm /tmp/dpdk-build as well.

Regards,
/Ruifeng
> +
> +WORKDIR /
> +
> +# Installed DPDK Shared library location:
> +# lib dir : /usr/local/lib/
> +# include : /usr/local/include/
> +# pkgconfig file: /usr/local/lib/x86_64-linux-gnu/pkgconfig/libdpdk.pc
> diff --git a/extras/README.md b/extras/README.md new file mode 100644
> index 0000000..8001012
> --- /dev/null
> +++ b/extras/README.md
> @@ -0,0 +1,51 @@
> +# Build DPDK Docker image
> +
> +To build a docker image run the following command from dpdk root
> directory.
> +
> +```
> +DOCKER_TAG="dpdk"
> +docker build -t ${DOCKER_TAG} -f extras/Dockerfile.bionic .
> +```
> +
> +# Example of how to use this dpdk library image
> +
> +The following steps shows how to use the dpdk shared library container
> +to build and run a dpdk application without having to build dpdk
> +library for each application.
> +
> +## Create a dpdk sample app docker file with 'dpdk' as the base image
> +
> +Create a docker file to build the helloworld application from
> +example/helloworld source files in dpdk root directory.
> +
> +```
> +cat << EOF > Dockerfile.dpdkSampleApp
> +FROM dpdk
> +
> +ADD examples/helloworld /opt/examples/helloworld
> +
> +WORKDIR /opt/examples/helloworld
> +RUN make && cp build/helloworld-shared /usr/local/bin/helloworld EOF
> +```
> +
> +## Build sample app docker image
> +
> +```
> +DOCKERAPP_TAG="dpdk-helloworld"
> +docker build -t ${DOCKERAPP_TAG} -f Dockerfile.dpdkSampleApp .
> +```
> +
> +This sample app now can be run like any other applicaiton in a docker
> container.
> +
> +```
> +$ docker run --rm --privileged -it  -v /dev/hugepages:/dev/hugepages
> +dpdk-helloworld ```
> +
> +## Running the sample app
> +Once inside the container run helloword binary
> +
> +```
> +$ root@11233ed2e69c # helloworld
> +```
> +
> --
> 1.8.3.1
> 
> --------------------------------------------------------------
> Intel Research and Development Ireland Limited Registered in Ireland
> Registered Office: Collinstown Industrial Park, Leixlip, County Kildare
> Registered Number: 308263
> 
> 
> This e-mail and any attachments may contain confidential material for the
> sole use of the intended recipient(s). Any review or distribution by others is
> strictly prohibited. If you are not the intended recipient, please contact the
> sender and delete all copies.
Abdul Halim Dec. 11, 2019, 10:53 a.m. UTC | #3
> -----Original Message-----
> From: Ray Kinsella <mdr@ashroe.eu>
> Sent: Tuesday, December 10, 2019 5:45 PM
> To: dev@dpdk.org; Halim, Abdul <abdul.halim@intel.com>
> Subject: Re: [dpdk-dev] [PATCH v5] build: add dockerfile for building docker
> image
> 
> 
> 
> On 10/12/2019 13:55, Abdul Halim wrote:
> > Adding a Dockerfile with Ubuntu bionic base image to build dpdk as
> > shared library. This docker image could be used as base image to build
> > and run dpdk applications in containers.
> >
> > Signed-off-by: Abdul Halim <abdul.halim@intel.com>
> >
> > ---
> >
> > v2:
> >   * renamed Dockerfile name from Dockerfile.ubuntu to Dockerfile.bionic
> >   * added call to ldconfig to update cache of libraries to include newly
> >     installed DPDK libs
> >
> > ---
> >
> > v3:
> >   * added example use-case of dpdk dockerfile in extras/README.md
> >
> > ---
> > v4:
> >   * changed meson build to use tmp dir in docker build
> >   * changed sample app dockerfile to add only helloworld source code
> >
> > ---
> > v5:
> >   * fix whitespace error
> > ---
> >  extras/Dockerfile.bionic | 40
> +++++++++++++++++++++++++++++++++++++
> >  extras/README.md         | 51
> ++++++++++++++++++++++++++++++++++++++++++++++++
> >  2 files changed, 91 insertions(+)
> >  create mode 100644 extras/Dockerfile.bionic  create mode 100644
> > extras/README.md
> >
> > diff --git a/extras/Dockerfile.bionic b/extras/Dockerfile.bionic new
> > file mode 100644 index 0000000..cf9c176
> > --- /dev/null
> > +++ b/extras/Dockerfile.bionic
> > @@ -0,0 +1,40 @@
> > +# SPDX-License-Identifier: BSD-3-Clause # Copyright(c) 2019 Intel
> > +Corporation FROM ubuntu:bionic
> > +
> > +# install requirements for getting and building DPDK # including
> > +dependencies for DPDK features RUN apt-get update && apt-get install
> > +-y \
> > +    build-essential \
> > +    pkg-config \
> > +    python3 \
> > +    python3-pip \
> > +    ninja-build \
> > +    libjansson-dev \
> > +    libbsd-dev \
> > +    libnuma-dev \
> > +    libssl-dev \
> > +    zlib1g-dev \
> > +    libpcap-dev \
> > +    libibverbs-dev \
> > +        && pip3 install meson \
> > +        && apt-get clean && rm -rf /var/lib/apt/lists/*
> > +
> > +ADD . /tmp/dpdk
> > +
> > +WORKDIR /tmp/dpdk
> > +
> > +RUN meson /tmp/dpdk-build \
> > +    -Ddefault_library=shared \
> > +    -Dmachine=default \
> > +    -Dper_library_versions=false \
> > +        && ninja -C /tmp/dpdk-build install \
> > +        && ldconfig \
> > +        && cd /; rm -rf /tmp/dpdk
> > +
> > +WORKDIR /
> > +
> > +# Installed DPDK Shared library location:
> > +# lib dir : /usr/local/lib/
> > +# include : /usr/local/include/
> > +# pkgconfig file:
> > +/usr/local/lib/x86_64-linux-gnu/pkgconfig/libdpdk.pc
> > diff --git a/extras/README.md b/extras/README.md new file mode
> 100644
> > index 0000000..8001012
> > --- /dev/null
> > +++ b/extras/README.md
> > @@ -0,0 +1,51 @@
> > +# Build DPDK Docker image
> > +
> > +To build a docker image run the following command from dpdk root
> directory.
> > +
> > +```
> > +DOCKER_TAG="dpdk"
> > +docker build -t ${DOCKER_TAG} -f extras/Dockerfile.bionic .
> > +```
> > +
> > +# Example of how to use this dpdk library image
> > +
> > +The following steps shows how to use the dpdk shared library
> > +container to build and run a dpdk application without having to build
> > +dpdk library for each application.
> > +
> > +## Create a dpdk sample app docker file with 'dpdk' as the base image
> > +
> > +Create a docker file to build the helloworld application from
> > +example/helloworld source files in dpdk root directory.
> > +
> > +```
> > +cat << EOF > Dockerfile.dpdkSampleApp FROM dpdk
> > +
> > +ADD examples/helloworld /opt/examples/helloworld
> > +
> > +WORKDIR /opt/examples/helloworld
> > +RUN make && cp build/helloworld-shared /usr/local/bin/helloworld EOF
> > +```
> > +
> > +## Build sample app docker image
> > +
> > +```
> > +DOCKERAPP_TAG="dpdk-helloworld"
> > +docker build -t ${DOCKERAPP_TAG} -f Dockerfile.dpdkSampleApp .
> > +```
> > +
> > +This sample app now can be run like any other applicaiton in a docker
> container.
> > +
> > +```
> > +$ docker run --rm --privileged -it  -v /dev/hugepages:/dev/hugepages
> > +dpdk-helloworld ```
> > +
> > +## Running the sample app
> > +Once inside the container run helloword binary
> > +
> > +```
> > +$ root@11233ed2e69c # helloworld
> > +```
> > +
> >
> 
> Hi Abdul,
> 
> Other's feel free to shoot me down.
> But I am not sure that HelloWorld is really the example we want to show
> here.
> 
> HelloWorld is good and it minimizes the associated config you need to
> describe.
> However does it really help a someone get started running DPDK in a
> container, as there is no network interface.
> 
> Is there anyway we could show something running on a network interface?
> Perhaps we contrive something simple with vEth, AF_Packet and TestPMD?
> 
> Ray K

Hi Ray,
Our intent here is to show how to use this dpdk shared lib in container to build 
an application and run it. The same steps can be taken for any other advanced 
DPDK apps to take advantage of this shared library.
As you've mentioned, other apps will require various  HW related configuration 
to be shown and explained. The DPDK documentation already cover them 
in details. And that may unintentionally divert the focus to that particular app.
This is my opinion only :) 

However, if you strongly feel that the example should be with one of the apps
you've mentioned I can update it accordingly.

Many thanks!

Regards,
Abdul
--------------------------------------------------------------
Intel Research and Development Ireland Limited
Registered in Ireland
Registered Office: Collinstown Industrial Park, Leixlip, County Kildare
Registered Number: 308263


This e-mail and any attachments may contain confidential material for the sole
use of the intended recipient(s). Any review or distribution by others is
strictly prohibited. If you are not the intended recipient, please contact the
sender and delete all copies.
Abdul Halim Dec. 11, 2019, 4:35 p.m. UTC | #4
> -----Original Message-----
> From: Ruifeng Wang (Arm Technology China) <Ruifeng.Wang@arm.com>
> Sent: Wednesday, December 11, 2019 6:45 AM
> To: Halim, Abdul <abdul.halim@intel.com>; dev@dpdk.org
> Cc: Kinsella, Ray <ray.kinsella@intel.com>; yasufum.o@gmail.com; nd
> <nd@arm.com>
> Subject: RE: [PATCH v5] build: add dockerfile for building docker image
> 
> 
> > -----Original Message-----
> > From: Abdul Halim <abdul.halim@intel.com>
> > Sent: Tuesday, December 10, 2019 21:55
> > To: dev@dpdk.org
> > Cc: ray.kinsella@intel.com; yasufum.o@gmail.com; Ruifeng Wang (Arm
> > Technology China) <Ruifeng.Wang@arm.com>; Abdul Halim
> > <abdul.halim@intel.com>
> > Subject: [PATCH v5] build: add dockerfile for building docker image
> >
> > Adding a Dockerfile with Ubuntu bionic base image to build dpdk as
> > shared library. This docker image could be used as base image to build
> > and run dpdk applications in containers.
> >
> > Signed-off-by: Abdul Halim <abdul.halim@intel.com>
> >
> > ---
> >
> > v2:
> >   * renamed Dockerfile name from Dockerfile.ubuntu to Dockerfile.bionic
> >   * added call to ldconfig to update cache of libraries to include newly
> >     installed DPDK libs
> >
> > ---
> >
> > v3:
> >   * added example use-case of dpdk dockerfile in extras/README.md
> >
> > ---
> > v4:
> >   * changed meson build to use tmp dir in docker build
> >   * changed sample app dockerfile to add only helloworld source code
> >
> > ---
> > v5:
> >   * fix whitespace error
> > ---
> >  extras/Dockerfile.bionic | 40
> > +++++++++++++++++++++++++++++++++++++
> >  extras/README.md         | 51
> > ++++++++++++++++++++++++++++++++++++++++++++++++
> >  2 files changed, 91 insertions(+)
> >  create mode 100644 extras/Dockerfile.bionic  create mode 100644
> > extras/README.md
> >
> > diff --git a/extras/Dockerfile.bionic b/extras/Dockerfile.bionic new
> > file mode
> > 100644 index 0000000..cf9c176
> > --- /dev/null
> > +++ b/extras/Dockerfile.bionic
> > @@ -0,0 +1,40 @@
> > +# SPDX-License-Identifier: BSD-3-Clause # Copyright(c) 2019 Intel
> > +Corporation FROM ubuntu:bionic
> > +
> > +# install requirements for getting and building DPDK # including
> > +dependencies for DPDK features RUN apt-get update && apt-get install
> > +-y \
> > +    build-essential \
> > +    pkg-config \
> > +    python3 \
> > +    python3-pip \
> > +    ninja-build \
> > +    libjansson-dev \
> > +    libbsd-dev \
> > +    libnuma-dev \
> > +    libssl-dev \
> > +    zlib1g-dev \
> > +    libpcap-dev \
> > +    libibverbs-dev \
> > +        && pip3 install meson \
> > +        && apt-get clean && rm -rf /var/lib/apt/lists/*
> > +
> > +ADD . /tmp/dpdk
> > +
> > +WORKDIR /tmp/dpdk
> > +
> > +RUN meson /tmp/dpdk-build \
> > +    -Ddefault_library=shared \
> > +    -Dmachine=default \
> > +    -Dper_library_versions=false \
> > +        && ninja -C /tmp/dpdk-build install \
> > +        && ldconfig \
> > +        && cd /; rm -rf /tmp/dpdk
> 
> You may want to rm /tmp/dpdk-build as well.
Sure, I'll update the patch.
> 
> Regards,
> /Ruifeng
> > +
> > +WORKDIR /
> > +
> > +# Installed DPDK Shared library location:
> > +# lib dir : /usr/local/lib/
> > +# include : /usr/local/include/
> > +# pkgconfig file:
> > +/usr/local/lib/x86_64-linux-gnu/pkgconfig/libdpdk.pc
> > diff --git a/extras/README.md b/extras/README.md new file mode
> 100644
> > index 0000000..8001012
> > --- /dev/null
> > +++ b/extras/README.md
> > @@ -0,0 +1,51 @@
> > +# Build DPDK Docker image
> > +
> > +To build a docker image run the following command from dpdk root
> > directory.
> > +
> > +```
> > +DOCKER_TAG="dpdk"
> > +docker build -t ${DOCKER_TAG} -f extras/Dockerfile.bionic .
> > +```
> > +
> > +# Example of how to use this dpdk library image
> > +
> > +The following steps shows how to use the dpdk shared library
> > +container to build and run a dpdk application without having to build
> > +dpdk library for each application.
> > +
> > +## Create a dpdk sample app docker file with 'dpdk' as the base image
> > +
> > +Create a docker file to build the helloworld application from
> > +example/helloworld source files in dpdk root directory.
> > +
> > +```
> > +cat << EOF > Dockerfile.dpdkSampleApp FROM dpdk
> > +
> > +ADD examples/helloworld /opt/examples/helloworld
> > +
> > +WORKDIR /opt/examples/helloworld
> > +RUN make && cp build/helloworld-shared /usr/local/bin/helloworld EOF
> > +```
> > +
> > +## Build sample app docker image
> > +
> > +```
> > +DOCKERAPP_TAG="dpdk-helloworld"
> > +docker build -t ${DOCKERAPP_TAG} -f Dockerfile.dpdkSampleApp .
> > +```
> > +
> > +This sample app now can be run like any other applicaiton in a docker
> > container.
> > +
> > +```
> > +$ docker run --rm --privileged -it  -v /dev/hugepages:/dev/hugepages
> > +dpdk-helloworld ```
> > +
> > +## Running the sample app
> > +Once inside the container run helloword binary
> > +
> > +```
> > +$ root@11233ed2e69c # helloworld
> > +```
> > +
> > --
> > 1.8.3.1
> >
> > --------------------------------------------------------------
> > Intel Research and Development Ireland Limited Registered in Ireland
> > Registered Office: Collinstown Industrial Park, Leixlip, County
> > Kildare Registered Number: 308263
> >
> >
> > This e-mail and any attachments may contain confidential material for
> > the sole use of the intended recipient(s). Any review or distribution
> > by others is strictly prohibited. If you are not the intended
> > recipient, please contact the sender and delete all copies.

--------------------------------------------------------------
Intel Research and Development Ireland Limited
Registered in Ireland
Registered Office: Collinstown Industrial Park, Leixlip, County Kildare
Registered Number: 308263


This e-mail and any attachments may contain confidential material for the sole
use of the intended recipient(s). Any review or distribution by others is
strictly prohibited. If you are not the intended recipient, please contact the
sender and delete all copies.
Ray Kinsella Dec. 11, 2019, 5 p.m. UTC | #5
On 11/12/2019 10:53, Halim, Abdul wrote:
> 
> 
>> -----Original Message-----
>> From: Ray Kinsella <mdr@ashroe.eu>
>> Sent: Tuesday, December 10, 2019 5:45 PM
>> To: dev@dpdk.org; Halim, Abdul <abdul.halim@intel.com>
>> Subject: Re: [dpdk-dev] [PATCH v5] build: add dockerfile for building docker
>> image
>>
>>
>>
>> On 10/12/2019 13:55, Abdul Halim wrote:
>>> Adding a Dockerfile with Ubuntu bionic base image to build dpdk as
>>> shared library. This docker image could be used as base image to build
>>> and run dpdk applications in containers.
>>>
>>> Signed-off-by: Abdul Halim <abdul.halim@intel.com>
>>>
>>> ---
>>>
>>> v2:
>>>   * renamed Dockerfile name from Dockerfile.ubuntu to Dockerfile.bionic
>>>   * added call to ldconfig to update cache of libraries to include newly
>>>     installed DPDK libs
>>>
>>> ---
>>>
>>> v3:
>>>   * added example use-case of dpdk dockerfile in extras/README.md
>>>
>>> ---
>>> v4:
>>>   * changed meson build to use tmp dir in docker build
>>>   * changed sample app dockerfile to add only helloworld source code
>>>
>>> ---
>>> v5:
>>>   * fix whitespace error
>>> ---
>>>  extras/Dockerfile.bionic | 40
>> +++++++++++++++++++++++++++++++++++++
>>>  extras/README.md         | 51
>> ++++++++++++++++++++++++++++++++++++++++++++++++
>>>  2 files changed, 91 insertions(+)
>>>  create mode 100644 extras/Dockerfile.bionic  create mode 100644
>>> extras/README.md
>>>
>>> diff --git a/extras/Dockerfile.bionic b/extras/Dockerfile.bionic new
>>> file mode 100644 index 0000000..cf9c176
>>> --- /dev/null
>>> +++ b/extras/Dockerfile.bionic
>>> @@ -0,0 +1,40 @@
>>> +# SPDX-License-Identifier: BSD-3-Clause # Copyright(c) 2019 Intel
>>> +Corporation FROM ubuntu:bionic
>>> +
>>> +# install requirements for getting and building DPDK # including
>>> +dependencies for DPDK features RUN apt-get update && apt-get install
>>> +-y \
>>> +    build-essential \
>>> +    pkg-config \
>>> +    python3 \
>>> +    python3-pip \
>>> +    ninja-build \
>>> +    libjansson-dev \
>>> +    libbsd-dev \
>>> +    libnuma-dev \
>>> +    libssl-dev \
>>> +    zlib1g-dev \
>>> +    libpcap-dev \
>>> +    libibverbs-dev \
>>> +        && pip3 install meson \
>>> +        && apt-get clean && rm -rf /var/lib/apt/lists/*
>>> +
>>> +ADD . /tmp/dpdk
>>> +
>>> +WORKDIR /tmp/dpdk
>>> +
>>> +RUN meson /tmp/dpdk-build \
>>> +    -Ddefault_library=shared \
>>> +    -Dmachine=default \
>>> +    -Dper_library_versions=false \
>>> +        && ninja -C /tmp/dpdk-build install \
>>> +        && ldconfig \
>>> +        && cd /; rm -rf /tmp/dpdk
>>> +
>>> +WORKDIR /
>>> +
>>> +# Installed DPDK Shared library location:
>>> +# lib dir : /usr/local/lib/
>>> +# include : /usr/local/include/
>>> +# pkgconfig file:
>>> +/usr/local/lib/x86_64-linux-gnu/pkgconfig/libdpdk.pc
>>> diff --git a/extras/README.md b/extras/README.md new file mode
>> 100644
>>> index 0000000..8001012
>>> --- /dev/null
>>> +++ b/extras/README.md
>>> @@ -0,0 +1,51 @@
>>> +# Build DPDK Docker image
>>> +
>>> +To build a docker image run the following command from dpdk root
>> directory.
>>> +
>>> +```
>>> +DOCKER_TAG="dpdk"
>>> +docker build -t ${DOCKER_TAG} -f extras/Dockerfile.bionic .
>>> +```
>>> +
>>> +# Example of how to use this dpdk library image
>>> +
>>> +The following steps shows how to use the dpdk shared library
>>> +container to build and run a dpdk application without having to build
>>> +dpdk library for each application.
>>> +
>>> +## Create a dpdk sample app docker file with 'dpdk' as the base image
>>> +
>>> +Create a docker file to build the helloworld application from
>>> +example/helloworld source files in dpdk root directory.
>>> +
>>> +```
>>> +cat << EOF > Dockerfile.dpdkSampleApp FROM dpdk
>>> +
>>> +ADD examples/helloworld /opt/examples/helloworld
>>> +
>>> +WORKDIR /opt/examples/helloworld
>>> +RUN make && cp build/helloworld-shared /usr/local/bin/helloworld EOF
>>> +```
>>> +
>>> +## Build sample app docker image
>>> +
>>> +```
>>> +DOCKERAPP_TAG="dpdk-helloworld"
>>> +docker build -t ${DOCKERAPP_TAG} -f Dockerfile.dpdkSampleApp .
>>> +```
>>> +
>>> +This sample app now can be run like any other applicaiton in a docker
>> container.
>>> +
>>> +```
>>> +$ docker run --rm --privileged -it  -v /dev/hugepages:/dev/hugepages
>>> +dpdk-helloworld ```
>>> +
>>> +## Running the sample app
>>> +Once inside the container run helloword binary
>>> +
>>> +```
>>> +$ root@11233ed2e69c # helloworld
>>> +```
>>> +
>>>
>>
>> Hi Abdul,
>>
>> Other's feel free to shoot me down.
>> But I am not sure that HelloWorld is really the example we want to show
>> here.
>>
>> HelloWorld is good and it minimizes the associated config you need to
>> describe.
>> However does it really help a someone get started running DPDK in a
>> container, as there is no network interface.
>>
>> Is there anyway we could show something running on a network interface?
>> Perhaps we contrive something simple with vEth, AF_Packet and TestPMD?
>>
>> Ray K
> 
> Hi Ray,
> Our intent here is to show how to use this dpdk shared lib in container to build 
> an application and run it. The same steps can be taken for any other advanced 
> DPDK apps to take advantage of this shared library.
> As you've mentioned, other apps will require various  HW related configuration 
> to be shown and explained. The DPDK documentation already cover them 
> in details. And that may unintentionally divert the focus to that particular app.
> This is my opinion only :) 
> 
> However, if you strongly feel that the example should be with one of the apps
> you've mentioned I can update it accordingly.
> 
> Many thanks!
> 
> Regards,
> Abdul

My simple point is that DPDK without a network card, is not the majority use case.
Dataplane Development Kit implies some sort of a network data plane :-)

Thanks, 

Ray K

Patch
diff mbox series

diff --git a/extras/Dockerfile.bionic b/extras/Dockerfile.bionic
new file mode 100644
index 0000000..cf9c176
--- /dev/null
+++ b/extras/Dockerfile.bionic
@@ -0,0 +1,40 @@ 
+# SPDX-License-Identifier: BSD-3-Clause
+# Copyright(c) 2019 Intel Corporation
+FROM ubuntu:bionic
+
+# install requirements for getting and building DPDK
+# including dependencies for DPDK features
+RUN apt-get update && apt-get install -y \
+    build-essential \
+    pkg-config \
+    python3 \
+    python3-pip \
+    ninja-build \
+    libjansson-dev \
+    libbsd-dev \
+    libnuma-dev \
+    libssl-dev \
+    zlib1g-dev \
+    libpcap-dev \
+    libibverbs-dev \
+        && pip3 install meson \
+        && apt-get clean && rm -rf /var/lib/apt/lists/*
+
+ADD . /tmp/dpdk
+
+WORKDIR /tmp/dpdk
+
+RUN meson /tmp/dpdk-build \
+    -Ddefault_library=shared \
+    -Dmachine=default \
+    -Dper_library_versions=false \
+        && ninja -C /tmp/dpdk-build install \
+        && ldconfig \
+        && cd /; rm -rf /tmp/dpdk
+
+WORKDIR /
+
+# Installed DPDK Shared library location:
+# lib dir : /usr/local/lib/
+# include : /usr/local/include/
+# pkgconfig file: /usr/local/lib/x86_64-linux-gnu/pkgconfig/libdpdk.pc
diff --git a/extras/README.md b/extras/README.md
new file mode 100644
index 0000000..8001012
--- /dev/null
+++ b/extras/README.md
@@ -0,0 +1,51 @@ 
+# Build DPDK Docker image
+
+To build a docker image run the following command from dpdk root directory.
+
+```
+DOCKER_TAG="dpdk"
+docker build -t ${DOCKER_TAG} -f extras/Dockerfile.bionic .
+```
+
+# Example of how to use this dpdk library image
+
+The following steps shows how to use the dpdk shared library container to build
+and run a dpdk application without having to build dpdk library for each
+application.
+
+## Create a dpdk sample app docker file with 'dpdk' as the base image
+
+Create a docker file to build the helloworld application from example/helloworld
+source files in dpdk root directory.
+
+```
+cat << EOF > Dockerfile.dpdkSampleApp
+FROM dpdk
+
+ADD examples/helloworld /opt/examples/helloworld
+
+WORKDIR /opt/examples/helloworld
+RUN make && cp build/helloworld-shared /usr/local/bin/helloworld
+EOF
+```
+
+## Build sample app docker image
+
+```
+DOCKERAPP_TAG="dpdk-helloworld"
+docker build -t ${DOCKERAPP_TAG} -f Dockerfile.dpdkSampleApp .
+```
+
+This sample app now can be run like any other applicaiton in a docker container.
+
+```
+$ docker run --rm --privileged -it  -v /dev/hugepages:/dev/hugepages dpdk-helloworld
+```
+
+## Running the sample app
+Once inside the container run helloword binary
+
+```
+$ root@11233ed2e69c # helloworld
+```
+