Network simulation with Containerlab
Containerlab is a tool for provisioning networking labs built with containers. It is free.
Before we begin, The following requirements must be satisfied to let containerlab tool run successfully:
- A user should have
sudo
privileges to run containerlab. - A Linux server/VM and Docker installed.
- Load container images (e.g. Nokia SR Linux, Arista cEOS) that are not downloadable from a container registry. Containerlab will try to pull images at runtime if they do not exist locally.
first we need install docker, in this case we use ubuntu 24.04
Remove all old version of docker
for pkg in docker.io docker-doc docker-compose docker-compose-v2 podman-docker containerd runc; do sudo apt-get remove $pkg; done
Set up Docker’s apt Repository
# Add Docker's official GPG key:
sudo apt-get update
sudo apt-get install ca-certificates curl
sudo install -m 0755 -d /etc/apt/keyrings
sudo curl -fsSL <https://download.docker.com/linux/ubuntu/gpg> -o /etc/apt/keyrings/docker.asc
sudo chmod a+r /etc/apt/keyrings/docker.asc
# Add the repository to Apt sources:
echo \\\\
"deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] <https://download.docker.com/linux/ubuntu> \\\\
$(. /etc/os-release && echo "$VERSION_CODENAME") stable" | \\\\
sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
sudo apt-get update
Install docker
sudo apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
Verify the docker successfully installed
docker version
Begin install the containerlab
To install all components at once, run the following command on any of the supported OSes:
curl -sL <https://containerlab.dev/setup> | sudo -E bash -s "all"
Once installed, containerlab manages the labs defined in the so-called topology definition, clab
files.
Deploying a lab
example topology:

user can write a topology definition file from scratch example:
mkdir ~/demolab
cd ~/demolab
nano demolab.clab.yaml
name: demolab
topology:
nodes:
srl_sw1:
kind: nokia_srlinux
image: ghcr.io/nokia/srlinux
srl_sw2:
kind: nokia_srlinux
image: ghcr.io/nokia/srlinux
links:
- endpoints: ["srl_sw1:e1-1", "srl_sw2:e1-1"]
on that topology we use nokia srlinux image, before we deploy the lab we can pull that images with
docker pull ghcr.io/nokia/srlinux
Deploy lab
containerlab deploy
deploy command will automatically lookup a file matching the *.clab.y*ml patter to select it.

Accessing the node:
now we can see two container is running indicated two nokia srl switch is running.
to access the node we can use ssh
ssh admin@clab-demolab-srl-sw1

Removing Lab
To remove the lab, use the destroy
command that takes a topology file as an argument:
containerlab destroy