Build ns-3 on Docker Ubuntu image on Windows 10/11

Build ns-3 open source network simulation software in a convenient Docker image

Tech Notes
3 min readFeb 25, 2022



You need to have Docker installed and be comfortable with Docker on the command line.

My Specs

At the time of writing this tutorial I was using Ubuntu 18.04 to build ns-3, however, I have had to update my Dockerfile so that it uses ubuntu:latest, which is now 20 something. With apt-get install and such things I think with super old versions of Ubuntu the packages can stop working and such things, so please keep in mind that I cannot possibly maintain every tutorial I write, and some of the calls in the Dockerfile to apt-get install may have new or updated package names or versions by the time you find this tutorial.

Example Code

See an example project on my Github

Step 0

Open Powershell and create a folder called ns3-docker

mkdir ns3-docker

cd into that folder and create a file named Dockerfile

cd ns3-docker
New-Item -Name Dockerfile -ItemType File

Step 1

Put this into your Dockerfile

FROM ubuntu:18.04
RUN echo hello world!

Look at the FROM statement, here, instead of creating our own base image, we’ll use the official Node.js image that already has all the tools and packages that we need. In this case the “12-alpine” image from Node

Step 2

Traditionally, the Dockerfile is called Dockerfile and located in the root of the “context”. The context is a folder with all the files we will need to build the Docker image. I am passing in . as the context dir. There is only one file in this folder right now and that is the Dockerfile.

$ docker build .

Here is my output:

PS C:\Users\ashle\Documents\GitHub\ns3-docker> docker build .
[+] Building 1.7s (10/10) FINISHED
=> [internal]…