vscode-containerlab

A Visual Studio Code extension that integrates containerlab directly into your editor, providing a convenient tree view for managing labs and their containers.

Key Features
Auto-discovery & Tree View:
Automatically find .clab.yml /.clab.yaml files in your workspace and display them in a tree view. Labs are color-coded based on container states:
- Green: All containers running
- Red: All containers stopped
- Yellow: Mixed (partial deployment)
- Gray: Undeployed labs
Context Menu Actions:
For labs and containers, quickly deploy, destroy, redeploy (with or without cleanup), save, inspect, delete undeployed lab files, or open lab files and workspaces. For containers, additional commands include starting, stopping, attaching a shell, SSH, viewing logs, and copying key properties (name, ID, IP addresses, kind, image).
Interface Tools:
Capture traffic (via tcpdump/Wireshark or Edgeshark) and set link impairments such as delay, jitter, packet loss, rate-limit, and corruption. You can also copy an interface’s MAC address.
Graphing & Visualization:
Generate network graphs in multiple modes:
- Draw.io (Horizontal): Generates a
.drawio file in a horizontal layout. (pos labels will overwrite the layout)
- Draw.io (Vertical): Generates a
.drawio file in a vertical layout. (pos labels will overwrite the layout)
- Interactive TopoViewer: Launches a dynamic, web-based view of your topology.
- Interactive TopoEditor: Let's your create in a graphical way network topologies
Clone Labs from Git:
Easily clone labs from any Git repository or choose from a list of popular labs directly within the extension.
Help & Feedback View:
Access documentation, community links, and other helpful resources from a dedicated tree view.
Inspection:
Use webviews to inspect either all labs or a single lab’s deployed containers in a neatly grouped table.
Remote Labs:
Works perfectly with the: SSH-Remote extension to manage labs on remote servers.
Remote Topology URLs:
Deploy labs directly from GitHub or GitLab by providing a repository or file URL when using the "Deploy an existing lab" command.
Requirements
containerlab must be installed and accessible in your system PATH . The extension will offer to install it if not found.
(Optional) Edgeshark for packet capture features - can be installed directly from the extension using the "Install Edgeshark" command.
Edgeshark Integration
Install Edgeshark: installs Edgeshark using docker compose
Uninstall Edgeshark: removes Edgeshark containers
Configure session hostname: set hostname for remote connections (packet capture)
If you want to live capture traffic using Wireshark, please download the cshargextcap plugin for the OS/distribution and install it.
Note: The extension will automatically prompt to add your user to the clab_admins group during setup to enable running containerlab commands without sudo.
Getting Started
- Install the extension.
- Open a folder or workspace in VS Code containing
.clab.yml or .clab.yaml files. Or just clone a popular lab.
- Click on the Containerlab icon in the Activity Bar to view your labs.
- Right-click on a lab or container to see context menu commands (Deploy, Destroy, Redeploy, etc.).
Extension Settings
Customize your experience under containerlab.* in VS Code Settings:
containerlab.sudoEnabledByDefault (boolean)
Whether to prepend sudo to containerlab commands.
Default: true
containerlab.refreshInterval (number)
Auto-refresh interval (in ms) for the Containerlab Explorer.
Default: 10000
containerlab.node.execCommandMapping (object)
Map a node’s kind to its preferred exec command (e.g. { "nokia_srlinux": "sr_cli" } ).
containerlab.node.sshUserMapping (object)
Map a node’s kind to its preferred ssh user (e.g. { "nokia_srlinux": "clab" } ).
containerlab.wsl.wiresharkPath (string)
Path to Wireshark in Windows from inside WSL.
Default: /mnt/c/Program Files/Wireshark/wireshark.exe
containerlab.remote.hostname (string)
Hostname or IP used for remote connections (affects packet capture).
Note: Session-specific hostname settings take precedence.
containerlab.drawioDefaultTheme (string)
Theme for Draw.io graphs. Options: nokia_modern , nokia , grafana .
Default: nokia_modern
containerlab.runtime (string)
The container runtime to use. Options: docker , podman , ignite .
Default: docker
containerlab.skipCleanupWarning (boolean)
If enabled, the extension will skip warning popups for cleanup commands (redeploy/destroy with cleanup).
Default: false
containerlab.deploy.extraArgs (string)
Additional options appended to every containerlab deploy or containerlab redeploy invocation.
Default: ""
containerlab.destroy.extraArgs (string)
Additional options appended to every containerlab destroy invocation.
Default: ""
containerlab.remote.packetflixPort (number)
Port to use for the Packetflix endpoint when capturing traffic remotely.
Default: 5001
containerlab.showWelcomePage (boolean)
Show the welcome page when the extension activates.
Default: true
containerlab.node.telnetPort (number)
Port used when telnetting into a node via docker exec -it <node> telnet 127.0.0.1 <port> .
Default: 5000
Example configuration:
"containerlab.deploy.extraArgs": "--timeout 5m --max-workers 88",
"containerlab.destroy.extraArgs": "--graceful --cleanup"
Monitor Deployment Progress
When deploying labs, you can monitor the detailed progress in the Output window:
- Open the Output panel (
Ctrl+Shift+U or View -> Output )
- Select "Containerlab" from the dropdown menu
- Watch the deployment logs in real-time
Auto-refresh Behavior
- The Containerlab Explorer automatically refreshes based on the
containerlab.refreshInterval setting
- Labs are consistently sorted:
- Deployed labs appear before undeployed labs
- Within each group (deployed/undeployed), labs are sorted by their absolute path
Known Issues
"I do not see any interfaces on my deployed lab"
Labs deployed with containerlab versions older than 0.64.0 may require a redeploy.
Running Tests
The extension includes a suite of unit tests located in the test folder. To run them:
- Install dependencies with
npm install if you haven't already.
- Compile the test TypeScript using
npm run test:compile .
- Execute
npm test to run Mocha and generate an HTML report in mochawesome-report .
See test/README.md for a short overview of the test setup and stub utilities.
Feedback and Contributions
If you’d like to request features or report issues:
Open an issue on our GitHub repository.
PRs are welcome! Let us know how we can improve the extension.
GitHub Issues: Create an issue on GitHub.
Discord: Join our Discord community
Enjoy managing your containerlab topologies directly from VS Code!
| |