Container nodes in Cisco Modeling Labs (CML) 2.9 complement digital machines, providing higher flexibility and effectivity. Engineers profit from having light-weight, programmable, and quickly deployable choices inside their simulation environments. Whereas digital machines (VMs) dominate with community working techniques, containers add flexibility, enabling instruments, site visitors injectors, automation, and full functions to run easily along with your CML topology. Conventional digital machines are nonetheless efficient, however customized containers introduce a transformative agility.
Constructing photographs that behave predictably and combine cleanly with simulated networks is far simpler with containers. As anybody who has tried to drop a inventory Docker picture into CML rapidly discovers, this isnāt an easy course of. Typical Docker photographs lack the mandatory CML-compatible metadata, community interface behaviors, and lifecycle properties. Utilizing containers with CML is the lacking component.
This weblog submit supplies a sensible, engineering-first walkthrough for constructing containers which are actually CML-ready.

Be aware about enhancements to CML: When containers had been launched, just one picture per node definition was allowed. With the CML 2.10 launch, this restriction has been lifted. Specifically, the next enhancements might be added:
- Per picture definition, Docker tag names reminiscent of:
debian:bookworm, debian:buster and debian:trixie
Are all legitimate tags for a similar ādebian-dockerā node definitionsāthree legitimate picture definitions for one node definition.
- Specification of Docker tags as a substitute for picture namesĀ (.tar.gz recordsdata) and SHA256 has sums. On this case, CML will attempt to obtain the picture from a container registry, e.g., Docker Hub, if not in any other case specified.
- Improved launch logicĀ to keep away from āperpetual launchesā in case the SHA256 sum from the picture definition didn’t match the precise hash sum within the picture.
Why do customized containers in CML matter?
Conventional CML workflows depend on VM-based nodes working IOSv, IOS-XRv, NX-OS, Ubuntu, Alpine, and different working techniques. These are wonderful for modeling community working system conduct, however theyāre heavyweight for duties reminiscent of integrating CLI instruments, net browsers, ephemeral controllers, containerized apps, microservices, and testing harnesses into your simulations.
Containers begin rapidly, eat fewer assets, and combine easily with customary NetDevOps CI/CD workflows. Regardless of their benefits, integrating customary Docker photographs into CML isnāt with out its challenges, every of which requires a tailor-made resolution for seamless performance.
The hidden challenges: why a Docker picture isnāt sufficient
CML doesnāt run containers in the identical means a vanilla Docker Engine does. As a substitute, it wraps containers in a specialised runtime setting that integrates with its simulation engine. This results in a number of potential pitfalls:
- Entry factors and init techniques
Many base photographs assume theyāre the solely course of working. In CML, community interfaces, startup scripts, and boot readiness ought to be offered. Additionally, CML expects a long-running foreground course of. In case your container exits instantly, CML will deal with the node as āfailed.ā - Interface mapping
Containers usually use eth0, but CML attaches interfaces sequentially primarily based on topology (eth0, eth1, eth2ā¦). Your picture ought to deal with further interfaces added at startup, mapping them to particular OS configurations. - Capabilities and customers
Some containers drop privileges by default. CMLās bootstrap course of may have particular entry privileges to configure networking or begin daemons. - Filesystem format
CML makes use of non-obligatory bootstrap belongings injected into the containerās filesystem. A typical Docker picture gainedāt have the precise directories, binaries, or permissions for this. If wanted, CML can āinjectā a full suite of command-line binaries (ābusyboxā) right into a container to offer a correct CLI setting. - Lifecycle expectations
Containers ought to output log data to the console in order that performance could be noticed in CML. For instance, an internet server ought to present the entry log.
Misalign any of those, and also youāll spend hours troubleshooting what seems to be a easy āit really works with runā situation.
How CML treats containers: A psychological mannequin for engineers
CMLās container capabilities revolve round a node-definition YAML file that describes:
- The picture to load or pull
- The bootstrap course of
- Atmosphere variables
- Interfaces and the way they bind
- Simulation conduct (startup order, CPU/reminiscence, logging)
- UI metadata
When a lab launches, CML:
- Deploys a container node
- Pulls or masses the container picture
- Applies networking definitions
- Injects metadata, IP tackle, and bootstrap scripts
- Screens node well being by way of logs and runtime state
Consider CML as āDocker-with-constraints-plus-network-injection.ā Understanding CMLās method to containers is foundational, however constructing them requires specificsālisted below are sensible suggestions to make sure your containers are CML-ready.
Ideas for constructing a CML-ready container
The container photographs constructed for CML 2.10 and ahead are created on GitHub. We use a GitHub Motion CI workflow to totally automate the construct course of. You may, in truth, use the identical workflow to construct your personal customized photographs able to be deployed in CML. Thereās loads of documentation and examples you could construct off of, offered within the repository* and on the Deep Wiki.**
Essential word: CML treats every node in a topology as a single, self-contained service or utility. Whereas it could be tempting to immediately deploy multi-container functions, usually outlined utilizing docker-compose , into CML by making an attempt to separate them into particular person CML nodes, this method is mostly not really useful and might result in important issues.
1.) Select the precise base
Begin from an already current container definition, like:
- nginx (single-purpose community daemon utilizing a vanilla upstream picture).
- Firefox (graphical consumer interface, customized construct course of).
- Or a customized CI-built base along with your customary automation framework.
Keep away from utilizing photographs that depend on SystemD except you explicitly configure it; SystemD inside containers could be tough.
2.) Outline a correct entry level
Your container should:
- Run a long-lived course of.
- Not daemonize within the background.
- Assist predictable logging.
- Preserve the container āaliveā for CML.
Right hereās a easy supervisor script:
#!bin/sh echo "Container beginning..." tailĀ -f /dev/null
Not glamorous, however efficient. You may change tailĀ -f /dev/nullĀ along with your service startup chain.
3.) Put together for a number of interfaces
CML might connect a number of interfaces to your topology. CML will run a DHCP course of on the primary interface, however except that first interface is L2-adjacent to an exterior connector in NAT mode, thereās NO assure it’ll purchase one! If it can’t purchase an IP tackle, it’s the lab adminās duty to offer IP tackle configuration per the day 0 configuration. Usually, ip config ⦠instructions can be utilized for this function.
Superior use circumstances you’ll be able to unlock
When you conquer customized containers, CML turns into dramatically extra versatile. Some widespread use circumstances amongst superior NetDevOps and SRE groups embrace:
Artificial site visitors and testing
Automation engines
- Nornir nodes
- pyATS/Genie check harness containers
- Ansible automation controllers
Distributed functions
- Fundamental service-mesh experiments
- API gateways and proxies
- Container-based middleboxes
Safety instruments
- Honeypots
- IDS/IPS elements
- Packet inspection frameworks
Deal with CML as a āfull-stack lab,ā enhancing its capabilities past a mere community simulator.
Make CML your personal lab
Creating customized containers for CML turns the platform from a simulation device into a whole, programmable check setting. Whether or not youāre validating automation workflows, modeling distributed techniques, prototyping community features, or just constructing light-weight utilities, containerized nodes help you adapt CML to your engineering wantsānot the opposite means round.
In case youāre prepared to increase your CML lab, the easiest way to begin is straightforward: construct a small container, copy and modify an current node definition, and drop it right into a two-node topology. When you see how easily it really works, youāll rapidly notice simply how far you’ll be able to push this function.
Would you prefer to make your personal customized container for CML? Tell us within the feedback!
* Github Repository ā Automation for constructing CML Docker Containers
** DeepWiki ā CML Docker Containers (CML 2.9+)
JoinĀ Cisco U.Ā | Be part of theāÆĀ Cisco Studying CommunityāÆat present without spending a dime.
Comply with Study with CiscoĀ
XāÆ|āÆThreadsĀ |Ā FbāÆ|āÆLinkedInāÆ|āÆInstagramāÆ|āÆYouTube
UseāÆĀ #CiscoUĀ andĀ #CiscoCertāÆto affix the dialog.
