Containerlab

Containerlab

Containerlab API Server

One server on your lab host. Every lab, every user, one REST API.
Deploy, inspect, exec, capture, and share labs from scripts, CI, or the Containerlab Apps.

curl -sk -X POST https://localhost:8090/login -H "Content-Type
: application/json" -d {\"username\":\"vagrant\",\"password\":\"vagrant\"}

Containerlab Web GUI

The Containerlab Web GUI is the standalone browser application for Containerlab. It runs as a container, serves the shared Containerlab GUI, and connects to one or more reachable clab-api-server endpoints.

The web GUI does not run labs by itself and does not start clab-api-server for you. The API server performs the lab operations on the Linux host that owns the container runtime and lab files.

Install and start clab-api-server on the lab host first. When the web GUI and API server run on the same Linux host, host networking is the simplest option:

docker run -d --name containerlab-app \
  --restart unless-stopped \
  --network host \
  ghcr.io/srl-labs/containerlab-web:latest

Open:

https://localhost:3001

to access the web UI.


Container images for ContainerLab labs


Containerlab Examples


Containerlab and VS-Code

Containerlab on a MacBook with Apple Silicon

There are multiple ways to run Containerlab on macOS. For example, you could create a Linux VM on macOS and run Containerlab there, but this requires managing the VM. If you prefer not to use a VM, there are two options with DevContainers. Docker-in-Docker and Docker-outside-Docker.

  • Docker-in-Docker – The container runs its own Docker daemon inside it.
  • Docker-outside-Docker – The container uses the Docker daemon from the host system (your Mac).

Containerlab and Windows

By leveraging the Windows Subsystem Linux (aka WSL) you can run Containerlabs on Windows almost like on Linux. WSL allows Windows users to run a lightweight Linux VM inside Windows, and we can leverage this to run containerlab.

There are two primary ways of running Containerlab on Windows:

  1. Running containerlab directly in the WSL VM.
  2. Running containerlab inside a Devcontainer inside WSL.

Containerlab desktop app

A native window for Linux, macOS, and Windows. On Linux it runs labs on the computer itself, like the VS Code extension. It can also sign in to clab-api-server on lab hosts, and shows all of them side by side.


topology:
  kinds:
    ceos:
      image: ceos:4.27.0F
    linux:
      image: ghcr.io/hellt/network-multitool
  nodes:
    pdx-rtr-eos-01:
      kind: ceos
      mgmt_ipv4: 172.100.100.11
    pdx-rtr-eos-02:
      kind: ceos
      mgmt_ipv4: 172.100.100.12
    pdx-rtr-eos-03:
      kind: ceos
      mgmt_ipv4: 172.100.100.13
    pdx-rtr-eos-04:
      kind: ceos
      image: ceos:4.27.0F
      mgmt_ipv4: 172.100.100.14
    client1:
      kind: linux
      mgmt_ipv4: 172.100.100.21
    client2:
      kind: linux
      mgmt_ipv4: 172.100.100.22
  links:
    - endpoints: ["pdx-rtr-eos-01:eth1", "pdx-rtr-eos-02:eth1"]
    - endpoints: ["pdx-rtr-eos-02:eth2", "pdx-rtr-eos-03:eth1"]
    - endpoints: ["pdx-rtr-eos-03:eth2", "pdx-rtr-eos-04:eth1"]
    # Client connections
    - endpoints: ["client1:eth1", "pdx-rtr-eos-01:eth2"]
    - endpoints: ["client2:eth1", "pdx-rtr-eos-04:eth2"]