DPDK-dev Archive on lore.kernel.org
 help / color / Atom feed
* [dpdk-dev] [PATCH] build: add dockerfile for building docker image
@ 2019-08-27 16:44 Abdul Halim
  2019-09-30  8:54 ` Ray Kinsella
                   ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: Abdul Halim @ 2019-08-27 16:44 UTC (permalink / raw)
  To: dev; +Cc: Abdul Halim

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>
---
 extras/Dockerfile.ubuntu | 38 ++++++++++++++++++++++++++++++++++++++
 extras/README.md         |  8 ++++++++
 2 files changed, 46 insertions(+)
 create mode 100644 extras/Dockerfile.ubuntu
 create mode 100644 extras/README.md

diff --git a/extras/Dockerfile.ubuntu b/extras/Dockerfile.ubuntu
new file mode 100644
index 0000000..3d5b36b
--- /dev/null
+++ b/extras/Dockerfile.ubuntu
@@ -0,0 +1,38 @@
+# 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 \
+	pkgconf \
+	python3 \
+	python3-pip \
+	ninja-build \
+	libjansson-dev \
+	libbsd-dev \
+	libnuma-dev \
+	libssl-dev \
+	zlib1g-dev \
+	libpcap-dev \
+	libibverbs-dev \
+		&& pip3 install meson
+
+ADD . /tmp/dpdk
+
+WORKDIR /tmp/dpdk
+
+RUN meson build \
+	-Ddefault_library=shared \
+	-Dmachine=default \
+	-Dper_library_versions=false \
+		&& ninja -C build install \
+        && 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..967ddf7
--- /dev/null
+++ b/extras/README.md
@@ -0,0 +1,8 @@
+# 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.ubuntu .
+```
-- 
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.


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [dpdk-dev] [PATCH] build: add dockerfile for building docker image
  2019-08-27 16:44 [dpdk-dev] [PATCH] build: add dockerfile for building docker image Abdul Halim
@ 2019-09-30  8:54 ` Ray Kinsella
  2019-09-30 12:21   ` Halim, Abdul
  2019-10-04 10:08 ` [dpdk-dev] [PATCH v2] " Abdul Halim
  2019-12-03 11:42 ` [dpdk-dev] [PATCH v3] " Abdul Halim
  2 siblings, 1 reply; 9+ messages in thread
From: Ray Kinsella @ 2019-09-30  8:54 UTC (permalink / raw)
  To: Abdul Halim, dev

Hi Abdul,

Comments inline.

On 27/08/2019 17:44, 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>
> ---
>  extras/Dockerfile.ubuntu | 38 ++++++++++++++++++++++++++++++++++++++
>  extras/README.md         |  8 ++++++++
>  2 files changed, 46 insertions(+)
>  create mode 100644 extras/Dockerfile.ubuntu
>  create mode 100644 extras/README.md
> 
> diff --git a/extras/Dockerfile.ubuntu b/extras/Dockerfile.ubuntu

So I would be concerned about it being called Dockerfile.ubuntu, because
at the moment it only covers Bionic, and Xenial is still supported until
April 21. The pattern FD.io VPP adopts is calling it Dockerfile.bionic.

> new file mode 100644
> index 0000000..3d5b36b
> --- /dev/null
> +++ b/extras/Dockerfile.ubuntu
> @@ -0,0 +1,38 @@
> +# 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 \
> +	pkgconf \
> +	python3 \
> +	python3-pip \
> +	ninja-build \
> +	libjansson-dev \
> +	libbsd-dev \
> +	libnuma-dev \
> +	libssl-dev \
> +	zlib1g-dev \
> +	libpcap-dev \
> +	libibverbs-dev \
> +		&& pip3 install meson
> +
> +ADD . /tmp/dpdk
> +
> +WORKDIR /tmp/dpdk
> +
> +RUN meson build \
> +	-Ddefault_library=shared \
> +	-Dmachine=default \
> +	-Dper_library_versions=false \
> +		&& ninja -C build install \
> +        && cd /; rm -rf /tmp/dpdk
> +

Is it safe to remove /tmp/dpdk, then remove the WORKDIR.
Should be the other way around?

> +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..967ddf7
> --- /dev/null
> +++ b/extras/README.md
> @@ -0,0 +1,8 @@
> +# 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.ubuntu .
> +```
> 

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [dpdk-dev] [PATCH] build: add dockerfile for building docker image
  2019-09-30  8:54 ` Ray Kinsella
@ 2019-09-30 12:21   ` Halim, Abdul
  0 siblings, 0 replies; 9+ messages in thread
From: Halim, Abdul @ 2019-09-30 12:21 UTC (permalink / raw)
  To: Ray Kinsella, dev

Hi Ray,
Thanks for your feedback.
Please see comments inline.

> -----Original Message-----
> From: Ray Kinsella [mailto:mdr@ashroe.eu]
> Sent: Monday, September 30, 2019 9:54 AM
> To: Halim, Abdul <abdul.halim@intel.com>; dev@dpdk.org
> Subject: Re: [dpdk-dev] [PATCH] build: add dockerfile for building docker
> image
> 
> Hi Abdul,
> 
> Comments inline.
> 
> On 27/08/2019 17:44, 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>
> > ---
> >  extras/Dockerfile.ubuntu | 38
> ++++++++++++++++++++++++++++++++++++++
> >  extras/README.md         |  8 ++++++++
> >  2 files changed, 46 insertions(+)
> >  create mode 100644 extras/Dockerfile.ubuntu  create mode 100644
> > extras/README.md
> >
> > diff --git a/extras/Dockerfile.ubuntu b/extras/Dockerfile.ubuntu
> 
> So I would be concerned about it being called Dockerfile.ubuntu, because at
> the moment it only covers Bionic, and Xenial is still supported until April 21.
> The pattern FD.io VPP adopts is calling it Dockerfile.bionic.

I will rename this file to Dockerfile.bionic as suggested.

> 
> > new file mode 100644
> > index 0000000..3d5b36b
> > --- /dev/null
> > +++ b/extras/Dockerfile.ubuntu
> > @@ -0,0 +1,38 @@
> > +# 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 \
> > +	pkgconf \
> > +	python3 \
> > +	python3-pip \
> > +	ninja-build \
> > +	libjansson-dev \
> > +	libbsd-dev \
> > +	libnuma-dev \
> > +	libssl-dev \
> > +	zlib1g-dev \
> > +	libpcap-dev \
> > +	libibverbs-dev \
> > +		&& pip3 install meson
> > +
> > +ADD . /tmp/dpdk
> > +
> > +WORKDIR /tmp/dpdk
> > +
> > +RUN meson build \
> > +	-Ddefault_library=shared \
> > +	-Dmachine=default \
> > +	-Dper_library_versions=false \
> > +		&& ninja -C build install \
> > +        && cd /; rm -rf /tmp/dpdk
> > +
> 
> Is it safe to remove /tmp/dpdk, then remove the WORKDIR.
> Should be the other way around?
>

The WORKDIR instruction sets the working directory for any RUN, CMD, ENTRYPOINT, COPY and ADD instructions that follow it. It is very much like 'cd' into a location for other commands to run in there. Once the dpdk build is finished successfully and library is installed we no longer need the source files in the final image. So, we can safely remove it and the subsequent ' WORKDIR /' instruction below ensures that WORKDIR is set to a valid location.
 
> > +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..967ddf7
> > --- /dev/null
> > +++ b/extras/README.md
> > @@ -0,0 +1,8 @@
> > +# 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.ubuntu .
> > +```
> >
--------------------------------------------------------------
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.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [dpdk-dev] [PATCH v2] build: add dockerfile for building docker image
  2019-08-27 16:44 [dpdk-dev] [PATCH] build: add dockerfile for building docker image Abdul Halim
  2019-09-30  8:54 ` Ray Kinsella
@ 2019-10-04 10:08 ` " Abdul Halim
  2019-10-15  8:39   ` Ray Kinsella
  2019-12-03 11:42 ` [dpdk-dev] [PATCH v3] " Abdul Halim
  2 siblings, 1 reply; 9+ messages in thread
From: Abdul Halim @ 2019-10-04 10:08 UTC (permalink / raw)
  To: dev; +Cc: ray.kinsella, Abdul Halim

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
---
 extras/Dockerfile.bionic | 40 ++++++++++++++++++++++++++++++++++++++++
 extras/README.md         |  8 ++++++++
 2 files changed, 48 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..f83b720
--- /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 build \
+    -Ddefault_library=shared \
+    -Dmachine=default \
+    -Dper_library_versions=false \
+        && ninja -C 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..f1aa898
--- /dev/null
+++ b/extras/README.md
@@ -0,0 +1,8 @@
+# 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 .
+```
-- 
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.


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [dpdk-dev] [PATCH v2] build: add dockerfile for building docker image
  2019-10-04 10:08 ` [dpdk-dev] [PATCH v2] " Abdul Halim
@ 2019-10-15  8:39   ` Ray Kinsella
  2019-11-13 20:26     ` Yasufumi Ogawa
  0 siblings, 1 reply; 9+ messages in thread
From: Ray Kinsella @ 2019-10-15  8:39 UTC (permalink / raw)
  To: Abdul Halim, dev; +Cc: ray.kinsella



On 04/10/2019 11:08, 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
> ---
>  extras/Dockerfile.bionic | 40 ++++++++++++++++++++++++++++++++++++++++
>  extras/README.md         |  8 ++++++++
>  2 files changed, 48 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..f83b720
> --- /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 build \
> +    -Ddefault_library=shared \
> +    -Dmachine=default \
> +    -Dper_library_versions=false \
> +        && ninja -C 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..f1aa898
> --- /dev/null
> +++ b/extras/README.md
> @@ -0,0 +1,8 @@
> +# 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 .
> +```
> 
Acked-by: Ray Kinsella <mdr@ashroe.eu>

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [dpdk-dev] [PATCH v2] build: add dockerfile for building docker image
  2019-10-15  8:39   ` Ray Kinsella
@ 2019-11-13 20:26     ` Yasufumi Ogawa
  0 siblings, 0 replies; 9+ messages in thread
From: Yasufumi Ogawa @ 2019-11-13 20:26 UTC (permalink / raw)
  To: Ray Kinsella, Abdul Halim, dev; +Cc: ray.kinsella

On 2019/10/15 1:39, Ray Kinsella wrote:
> 
> 
> On 04/10/2019 11:08, 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.
Hi Abdul,

I have tested your Dockerfile and confirmed that shared lib is generated 
under /usr/local as described in the Dockerfile.

Just a comment, I wonder if you add an example of usecase in 
documentation for helping users understanding how to use.

Regards,
Yasufumi

>>
>> 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
>> ---
>>   extras/Dockerfile.bionic | 40 ++++++++++++++++++++++++++++++++++++++++
>>   extras/README.md         |  8 ++++++++
>>   2 files changed, 48 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..f83b720
>> --- /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 build \
>> +    -Ddefault_library=shared \
>> +    -Dmachine=default \
>> +    -Dper_library_versions=false \
>> +        && ninja -C 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..f1aa898
>> --- /dev/null
>> +++ b/extras/README.md
>> @@ -0,0 +1,8 @@
>> +# 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 .
>> +```
>>
> Acked-by: Ray Kinsella <mdr@ashroe.eu>
> 
Tested-by: Yasufumi Ogawa <yasufum.o@gmail.com>

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [dpdk-dev] [PATCH v3] build: add dockerfile for building docker image
  2019-08-27 16:44 [dpdk-dev] [PATCH] build: add dockerfile for building docker image Abdul Halim
  2019-09-30  8:54 ` Ray Kinsella
  2019-10-04 10:08 ` [dpdk-dev] [PATCH v2] " Abdul Halim
@ 2019-12-03 11:42 ` " Abdul Halim
  2019-12-05 14:13   ` Ruifeng Wang (Arm Technology China)
  2 siblings, 1 reply; 9+ messages in thread
From: Abdul Halim @ 2019-12-03 11:42 UTC (permalink / raw)
  To: dev; +Cc: ray.kinsella, yasufum.o, Abdul Halim

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
---
 extras/Dockerfile.bionic | 40 +++++++++++++++++++++++++++++++++++++
 extras/README.md         | 52 ++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 92 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..f83b720
--- /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 build \
+    -Ddefault_library=shared \
+    -Dmachine=default \
+    -Dper_library_versions=false \
+        && ninja -C 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..f38d7f1
--- /dev/null
+++ b/extras/README.md
@@ -0,0 +1,52 @@
+# 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 dpdk helloworld application. Since, we are
+creating a docker file for dpdk helloworld app we need to add the dpdk source
+files, thus create the following docker file in dpdk root directory.
+
+```
+cat << EOF > Dockerfile.dpdkSampleApp
+FROM dpdk
+
+ADD . /opt/dpdk
+
+WORKDIR /opt/dpdk/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 -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.


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [dpdk-dev] [PATCH v3] build: add dockerfile for building docker image
  2019-12-03 11:42 ` [dpdk-dev] [PATCH v3] " Abdul Halim
@ 2019-12-05 14:13   ` Ruifeng Wang (Arm Technology China)
  2019-12-05 19:51     ` Yasufumi Ogawa
  0 siblings, 1 reply; 9+ messages in thread
From: Ruifeng Wang (Arm Technology China) @ 2019-12-05 14:13 UTC (permalink / raw)
  To: Abdul Halim, dev; +Cc: ray.kinsella, yasufum.o, nd


> -----Original Message-----
> From: dev <dev-bounces@dpdk.org> On Behalf Of Abdul Halim
> Sent: Tuesday, December 3, 2019 19:42
> To: dev@dpdk.org
> Cc: ray.kinsella@intel.com; yasufum.o@gmail.com; Abdul Halim
> <abdul.halim@intel.com>
> Subject: [dpdk-dev] [PATCH v3] 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
> ---
>  extras/Dockerfile.bionic | 40
> +++++++++++++++++++++++++++++++++++++
>  extras/README.md         | 52
> ++++++++++++++++++++++++++++++++++++++++++++++++
>  2 files changed, 92 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..f83b720
> --- /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 build \
> +    -Ddefault_library=shared \
> +    -Dmachine=default \
> +    -Dper_library_versions=false \
> +        && ninja -C 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..f38d7f1
> --- /dev/null
> +++ b/extras/README.md
> @@ -0,0 +1,52 @@
> +# 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 dpdk helloworld application. Since,
> +we are creating a docker file for dpdk helloworld app we need to add
> +the dpdk source files, thus create the following docker file in dpdk root
> directory.
> +
> +```
> +cat << EOF > Dockerfile.dpdkSampleApp
> +FROM dpdk
> +
> +ADD . /opt/dpdk
> +
> +WORKDIR /opt/dpdk/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 .
> +```

Hi Abdul,

I tried the steps on AArch64 platform, and hit error as below:

$ sudo docker build -t ${DOCKERAPP_TAG} -f Dockerfile.dpdkSampleApp .
Sending build context to Docker daemon   2.55GB
Step 1/4 : FROM dpdk
 ---> 955448007987
Step 2/4 : ADD . /opt/dpdk
 ---> d8b58019a7e2
Step 3/4 : WORKDIR /opt/dpdk/examples/helloworld
 ---> Running in 14fc89f7d3cd
Removing intermediate container 14fc89f7d3cd
 ---> 065a682c58fd
Step 4/4 : RUN make && cp build/helloworld-shared /usr/local/bin/helloworld
 ---> Running in 11e755a7180b
Makefile:44: *** "Please define RTE_SDK environment variable".  Stop.
The command '/bin/sh -c make && cp build/helloworld-shared /usr/local/bin/helloworld' returned a non-zero code: 2

Missing define of RTE_SDK and RTE_TARGET?

> +
> +This sample app now can be run like any other applicaiton in a docker
> container.
> +
> +```
> +$ docker run --rm -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.


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [dpdk-dev] [PATCH v3] build: add dockerfile for building docker image
  2019-12-05 14:13   ` Ruifeng Wang (Arm Technology China)
@ 2019-12-05 19:51     ` Yasufumi Ogawa
  0 siblings, 0 replies; 9+ messages in thread
From: Yasufumi Ogawa @ 2019-12-05 19:51 UTC (permalink / raw)
  To: Ruifeng Wang (Arm Technology China), Abdul Halim, dev; +Cc: ray.kinsella, nd

On 2019/12/05 23:13, Ruifeng Wang (Arm Technology China) wrote:
> 
>> -----Original Message-----
>> From: dev <dev-bounces@dpdk.org> On Behalf Of Abdul Halim
>> Sent: Tuesday, December 3, 2019 19:42
>> To: dev@dpdk.org
>> Cc: ray.kinsella@intel.com; yasufum.o@gmail.com; Abdul Halim
>> <abdul.halim@intel.com>
>> Subject: [dpdk-dev] [PATCH v3] 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>
>>
[...]
>> diff --git a/extras/README.md b/extras/README.md new file mode 100644
>> index 0000000..f38d7f1
>> --- /dev/null
>> +++ b/extras/README.md
>> @@ -0,0 +1,52 @@
>> +# 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 dpdk helloworld application. Since,
>> +we are creating a docker file for dpdk helloworld app we need to add
>> +the dpdk source files, thus create the following docker file in dpdk root
>> directory.
>> +
>> +```
>> +cat << EOF > Dockerfile.dpdkSampleApp
>> +FROM dpdk
>> +
>> +ADD . /opt/dpdk
>> +
>> +WORKDIR /opt/dpdk/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 .
>> +```
> 
> Hi Abdul,
> 
> I tried the steps on AArch64 platform, and hit error as below:
> 
> $ sudo docker build -t ${DOCKERAPP_TAG} -f Dockerfile.dpdkSampleApp .
> Sending build context to Docker daemon   2.55GB
> Step 1/4 : FROM dpdk
>   ---> 955448007987
> Step 2/4 : ADD . /opt/dpdk
>   ---> d8b58019a7e2
> Step 3/4 : WORKDIR /opt/dpdk/examples/helloworld
>   ---> Running in 14fc89f7d3cd
> Removing intermediate container 14fc89f7d3cd
>   ---> 065a682c58fd
> Step 4/4 : RUN make && cp build/helloworld-shared /usr/local/bin/helloworld
>   ---> Running in 11e755a7180b
> Makefile:44: *** "Please define RTE_SDK environment variable".  Stop.
> The command '/bin/sh -c make && cp build/helloworld-shared /usr/local/bin/helloworld' returned a non-zero code: 2
> 
> Missing define of RTE_SDK and RTE_TARGET?

Hi Ruifeng,

I think you run you run the command in dpdk/extras. However, this 
'Dockerfile.dpdkSampleApp' is expected to be run in dpdk's root dir so 
that it is mounted as '/opt/dpdk' in the second step above. I have 
tested this Dockerfile on Ubuntu 18.04 and compiled without any error. 
RTE_SDK is set correctly, but dpdk's directory is not mounted in the 
container.

Abdul,

 >> +docker build -t ${DOCKERAPP_TAG} -f Dockerfile.dpdkSampleApp .

I think this line should be corrected as following, and make it clear it 
should be run in dpdk's root.

   docker build -t ${DOCKERAPP_TAG} -f extras/Dockerfile.dpdkSampleApp .

Even if the container image is built successfully, there is another 
problem in running app because it isn't run in privileged mode.

root@0d2a309dfd2c:/opt/dpdk/examples/helloworld# helloworld
EAL: Detected 16 lcore(s)
EAL: Detected 1 NUMA nodes
...
EAL: Failed to get current mempolicy: Operation not permitted. Assuming 
MPOL_DEFAULT.
set_mempolicy: Operation not permitted
set_mempolicy: Operation not permitted
EAL: error allocating rte services array
EAL: FATAL: rte_service_init() failed
EAL: rte_service_init() failed
PANIC in main():
Cannot init EAL
5: [helloworld(+0x84a) [0x55555555484a]]
4: [/lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xe7) 
[0x7ffff7721b97]]
3: [helloworld(+0x818) [0x555555554818]]
2: [/usr/local/lib/x86_64-linux-gnu/librte_eal.so.20.1(__rte_panic+0xbd) 
[0x7ffff7afb410]]
1: 
[/usr/local/lib/x86_64-linux-gnu/librte_eal.so.20.1(rte_dump_stack+0x2e) 
[0x7ffff7b1598e]]
Aborted (core dumped)

I think '--privileged' option should be added to avoid the error.

$ docker run --rm --privileged -it  -v /dev/hugepages:/dev/hugepages 
dpdk-helloworld

I have one more suggestion. You might have added $USER to docker group 
and run docker without sudo like as following.

$ sudo groupadd docker
$ sudo usermod -aG docker $USER

I wounder it is better to use sudo in your examples, or add the 
instruction for users not familiar with docker.

Regards,
Yasufumi

> 
>> +
>> +This sample app now can be run like any other applicaiton in a docker
>> container.
>> +
>> +```
>> +$ docker run --rm -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.
> 

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, back to index

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-08-27 16:44 [dpdk-dev] [PATCH] build: add dockerfile for building docker image Abdul Halim
2019-09-30  8:54 ` Ray Kinsella
2019-09-30 12:21   ` Halim, Abdul
2019-10-04 10:08 ` [dpdk-dev] [PATCH v2] " Abdul Halim
2019-10-15  8:39   ` Ray Kinsella
2019-11-13 20:26     ` Yasufumi Ogawa
2019-12-03 11:42 ` [dpdk-dev] [PATCH v3] " Abdul Halim
2019-12-05 14:13   ` Ruifeng Wang (Arm Technology China)
2019-12-05 19:51     ` Yasufumi Ogawa

DPDK-dev Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/dpdk-dev/0 dpdk-dev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 dpdk-dev dpdk-dev/ https://lore.kernel.org/dpdk-dev \
		dev@dpdk.org
	public-inbox-index dpdk-dev

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.dpdk.dev


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git