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
- Access the Visual Studio Code marketplace.
- Search for:
Containerlab. - Or access directly: Containerlab Extension.
- After installing, you will see a Containerlab icon in the left sidebar.
2. Basic Usage
Creating and Editing Topologies
- Create files with the
.clab.ymlextension 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 DestroyRedeployGraph-
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
- Install the Remote - SSH extension.
- Click on the green SSH icon in the lower left corner.
- Select "Connect to Remote Host...".
- Fill in the connection information (host, user, etc.).
-
After connected:
-
Install the
Containerlabextension on the remote host (via VS Code). - Use the extension normally with the remote topologies.