Introduction:
In this tutorial, we will walk you through the steps to install utilities, in this case tcpdump, by extending the NetBeez nb-agent Docker image via a Dockerfile.
Step 1: Pull the NetBeez nb-agent Docker Image
First, pull the NetBeez nb-agent Docker image from Docker Hub using the following command:
docker pull netbeez/nb-agent:latest
Step 2: Create a Dockerfile
Create a Dockerfile in your working directory. You can use any text editor to do this. For example, using nano:
nano Dockerfile
Then, add the following content to your Dockerfile:
# Use the official NetBeez nb-agent image as the base image
FROM netbeez/nb-agent:latest
# Update and install tcpdump extended
RUN apt-get update && apt-get install -y tcpdump
Save the Dockerfile and exit the text editor.
Step 3: Build your Customized nb-agent Image
Now, you can build your customized nb-agent image using the Dockerfile you just created. Use the following command:
docker build -t my-nb-agent .
You can replace my-nb-agent with your desired image name.
Step 4: Run the Extended nb-agent Container
Now that you have created your customized nb-agent image with tcpdump extended, you can run a container from it:
docker run -d --name my-nb-agent-container my-nb-agent
Replace my-nb-agent-container with your desired container name. Additionally, see our Docker agent documentation in order to get the container connected to your dashboard.
Conclusion:
Now that you have successfully extended the NetBeez nb-agent Docker image with tcpdump. You can now capture and analyze network traffic using this extended container. You can access the container with the command docker exec -it my-nb-agent-container /bin/bash
and then run the tcpdump command from there.
You can use these steps to install other APT based utilities, as well add other configurations by using Dockerfile to extend the NetBeez nb-agent image.