Skip to content

Visual Studio Code

Containerlab has an official extension for Visual Studio Code, which significantly facilitates the creation, editing, viewing, and management of topologies in YAML format. This guide shows you how to install the extension, explore its features, and use it even in remote environments.


1. Extension Installation

Prerequisites

  • Visual Studio Code installed.
  • Containerlab installed (official documentation).
  • Docker installed and running on the system.

Installation

  1. Access the Visual Studio Code marketplace.
  2. Search for: Containerlab.
  3. Or access directly: Containerlab Extension.
  4. After installing, you will see a Containerlab icon in the left sidebar.

2. Basic Usage

Creating and Editing Topologies

  • Create files with the .clab.yml extension to define your topology.
  • Click on the Containerlab icon in the sidebar and select "Create Topology".
  • A new file will open with a basic structure for defining nodes and links.

Quick Actions via Explorer

In the side view:

  • Topologies are listed automatically.
  • Right-click on a topology to access:

  • Deploy

  • Destroy
  • Redeploy
  • Graph
  • Lab states are displayed with colored icons:

  • 🟠 Creating containers

  • 🟢 Lab running
  • 🔴 Error in creation

2.1 Nodes Tab

When expanding a topology:

  • Each node will be listed with its name and status.
  • Right-click on the node to:

  • Connect via SSH/Telnet.

  • Open terminal (docker exec).
  • Copy information: IP, MAC, vendor, name.
  • Start/stop/restart the node.
  • Save node configurations.
  • View logs.
  • Open the node's web port (if applicable).
  • Access the Link Impairments panel.

Interfaces

  • Left-click on the node to expand its interfaces.
  • For each interface:

  • Interface status is displayed.

  • Right-click → "Open with Wireshark" (requires the Edgeshark plugin installed).

2.2 Visualizing Topologies with TopoViewer

  • In the side view, right-click on a topology.
  • Select "Graph Topo View".
  • A graphical view (TopoViewer) will open showing:

  • Nodes with customizable icons via labels.

  • Connections.
  • Grouping and geolocation (optional via geo-lat, geo-long).

3. Remote Access via SSH

The Containerlab extension can be used in conjunction with Remote - SSH from VS Code, enabling complete remote use.

Step-by-Step

  1. Install the Remote - SSH extension.
  2. Click on the green SSH icon in the lower left corner.
  3. Select "Connect to Remote Host...".
  4. Fill in the connection information (host, user, etc.).
  5. After connected:

  6. Install the Containerlab extension on the remote host (via VS Code).

  7. Use the extension normally with the remote topologies.

Official Documentation