DPDK patches and discussions
 help / color / mirror / Atom feed
From: Yasufumi Ogawa <yasufum.o@gmail.com>
To: "Ruifeng Wang (Arm Technology China)" <Ruifeng.Wang@arm.com>,
	Abdul Halim <abdul.halim@intel.com>,
	"dev@dpdk.org" <dev@dpdk.org>
Cc: "ray.kinsella@intel.com" <ray.kinsella@intel.com>, nd <nd@arm.com>
Subject: Re: [dpdk-dev] [PATCH v3] build: add dockerfile for building docker image
Date: Fri, 6 Dec 2019 04:51:37 +0900	[thread overview]
Message-ID: <199e2fda-bfb2-bd46-0b89-9d575f6c8989@gmail.com> (raw)
In-Reply-To: <AM0PR08MB3986CA2D18F3D954C38022DF9E5C0@AM0PR08MB3986.eurprd08.prod.outlook.com>

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.
> 

  reply	other threads:[~2019-12-05 19:51 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-27 16:44 [dpdk-dev] [PATCH] " 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 [this message]
2019-12-06 11:12       ` Halim, Abdul
2019-12-09  3:23         ` Ruifeng Wang (Arm Technology China)
2019-12-09  9:44           ` Yasufumi Ogawa
2019-12-09 10:18         ` Yasufumi Ogawa
2019-12-10 13:16           ` Halim, Abdul
2019-12-10 13:44 ` [dpdk-dev] [PATCH v4] " Abdul Halim
2019-12-10 13:55 ` [dpdk-dev] [PATCH v5] " Abdul Halim
2019-12-10 17:44   ` Ray Kinsella
2019-12-11 10:53     ` Halim, Abdul
2019-12-11 17:00       ` Ray Kinsella
2023-06-12  2:44         ` Stephen Hemminger
2019-12-11  6:45   ` Ruifeng Wang (Arm Technology China)
2019-12-11 16:35     ` Halim, Abdul
2019-12-11 16:39 ` [dpdk-dev] [PATCH v6] " Abdul Halim
2019-12-12  6:53   ` Ruifeng Wang (Arm Technology China)

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=199e2fda-bfb2-bd46-0b89-9d575f6c8989@gmail.com \
    --to=yasufum.o@gmail.com \
    --cc=Ruifeng.Wang@arm.com \
    --cc=abdul.halim@intel.com \
    --cc=dev@dpdk.org \
    --cc=nd@arm.com \
    --cc=ray.kinsella@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).