Part 3: Build & Launch Docker* Containers
Learn how to build and launch two Docker* containers: one for testpmd and the other one for pktgen.
Hi, I'm Clayne with Intel. And I work with [software-defined networking, network function virtualization] SDN and NFV in the Data Center. Welcome to the third part of our series on fast networking in the Linux* data center.
In this part, we will build two containers that communicate with each other using [Data Plane Development Kit] DPDK enabled [sic] Open vSwitch*. First, an important note. So far in these videos, we've had one terminal window that executed commands in the context of the host operating system. But as we launch each container, that terminal window will take on the context of that container.
So in the end, you'll have three separate terminal windows each with its own context. This will make sense in another few minutes. However, you need to remember that every time you execute Vagrant ssh and launch another terminal window, you have to run the command that sets the environment in that window. And that command is listed here in the gray box.
First, we'll create a Dockerfile for the container that will run the testpmd app. We'll call this the testpmd container. This is a lot to type. So the file has already been created for you in the project on GitHub* down in the location shown in the top line. This is standard container methodology.
Once we have a Dockerfile that defines the testpmd container, build the testpmd Docker* container. First, change into the directory where the Dockerfile is and then define a tag or a name for the container, and then build it.
Next, we'll create the Dockerfile that defines the pktgen container. You can see from the first line that it actually uses the testpmd container as its basis, but the Dockerfile mostly adds things that are specific for the pktgen application. You can see the differences highlighted in red.
This file has also already been created for you down in the location shown on the top line. Now, let's build the pktgen Docker container like we built the testpmd container, only changing the directory and the tag.
Now, let's run the testpmd Docker container. But since this will change the context of our window, let's first open a new terminal window. First, enter the vagrant VM environment with Vagrant ssh. And then set the lab environment variables using the source step00-setemb command, and then export the tag, and then launch with the Docker run in privileged mode.
Note that we're mounting two volumes from the host environment into the container environment. The first is the /mnt/huge folder that contains the huge page files. And the second is the /usr/local/var/run/openvswitch directory that contains the Open vSwitch DPDK enabled Unix [sic] sockets.
Now, in step 16, we'll do the same thing for the pktgen Docker container by opening another terminal window. This is now the third window. Entering the VM context with Vagrant ssh, and then setting up our lab environment variables with source step00-setemv.
Then, we export the tag for the pktgen container we just built, and launch the second container with docker run. You should now have three terminal windows open, two in the pktgen and testpmd contexts. And one in the host OS context.
In this video, we built two containers, one for testpmd and the other one for pktgen And now you should have three open terminal windows on your desktop. In the next video, we'll launch the applications in these terminal windows and so we recommend that you stay tuned.