Part 2: Loading network OS images
Every node in a Containerlab lab is a container, so every network operating system you want to use must exist as a Docker image on the host first. How you get that image depends on the vendor. Some publish it in a public registry, some give you a file to download with an account, and some only ship a virtual machine disk.
This part shows all four routes on Ubuntu, then runs a two-router lab to prove an image works. It assumes you finished Part 1.
| Route | Typical images | Account needed | Command |
|---|---|---|---|
| Pull from a public registry | Linux hosts, FRRouting | No | docker pull |
| Import a vendor download | Arista cEOS | Free account | docker import |
| Load a vendor download | Cisco XRd | Cisco account with entitlement | docker load |
| Build from a VM disk (vrnetlab) | Cisco Catalyst 8000V, XRv 9000, Juniper vJunos, Nokia SR OS | Varies | make |
The routers in the labs of Parts 2 to 5 run Cisco IOS XR, as the XRd container image. The workshop cannot give you this image: you get it from Cisco yourself (Route 3 below). You also need the free Alpine Linux image from Route 1. The other two routes are here for reference, for when you build labs with other network operating systems.
Docker image basics
An image is named repository:tag, for example ios-xr/xrd-control-plane:7.11.2. The tag is usually the software version. A topology file refers to an image by exactly this name, so pick clear names and keep them.
| Task | Command |
|---|---|
| List images on the host | docker images |
| Give an image another name | docker tag <old name> <new name> |
| Remove an image | docker rmi <name> |
| Show disk used by images | docker system df |
| Load an image from a saved file | docker load -i <file> |
When you deploy a lab, Containerlab uses the local image if it exists and tries to pull it from a registry if it does not. Pulling only works for public images, so vendor images must be loaded before you deploy.
Network OS images are large. Allow 3–5 GB of disk per image, and check free space with df -h /var/lib/docker.
Route 1: pull a public image (Alpine Linux)
Images in a public registry need no account: docker pull downloads them. The labs in Parts 3 to 5 use Alpine Linux, a very small Linux image, for the hosts at the edge of the network:
docker pull alpine:3
docker images alpineThe image is small: docker images reports 8 to 13 MB, depending on the Docker version. It has the basic network tools a lab host needs: ip, ping and traceroute.
| Setting | Value |
|---|---|
| Containerlab kind | linux |
| Containerlab documentation | Linux container kind |
| Login | none: open a shell with docker exec (Part 4) |
| Interface names in the topology | eth1, eth2, … |
| Memory per node | a few MB |
Open-source routing software such as FRRouting is published in public registries too, and is pulled the same way.
Route 2: import a vendor download (Arista cEOS)
Arista’s cEOS is free but needs an account:
- Create an account at arista.com and log in.
- Go to Support → Software Download, open cEOS-lab, and download the 64-bit archive for your release, for example
cEOS64-lab-4.32.0F.tar.xz. - Copy the file to the lab host and import it, naming the image after its release:
docker import cEOS64-lab-4.32.0F.tar.xz ceos:4.32.0F
docker images ceoscEOS ships as a file system archive, not a saved image, which is why it uses docker import rather than docker load.
| Setting | Value |
|---|---|
| Containerlab kind | arista_ceos |
| Containerlab documentation | Arista cEOS kind |
| Login | admin / admin |
| Interface names in the topology | eth1, eth2, … |
Use cEOS 4.32.0F or later on current Ubuntu releases. Older releases need cgroups v1, which Ubuntu no longer uses by default.
Route 3: load a vendor download (Cisco XRd)
Cisco XRd runs IOS XR as a container, and it is the router used in the labs of this workshop. The control-plane image is the one for labs; the vRouter image is for forwarding performance and needs more host setup.
Get and load the image
Log in to software.cisco.com with a Cisco account that is entitled to XRd, and download the XRd control-plane archive for your release. If you are a student, ask your institution or instructor how to get access; Cisco decides who may download XRd.
Copy it to the lab host and unpack it. It contains the image file
xrd-control-plane-container-x64.dockerv1.tgzand signature files:mkdir xrd && tar -xzf xrd-control-plane-container-x64.<release>.tgz -C xrd ls xrdLoad the image and note the name Docker prints on the
Loaded image:line. The name differs between releases:docker load -i xrd/xrd-control-plane-container-x64.dockerv1.tgzHere
xrdis the folder you created in step 2, where the image file was unpacked. Run the command from the folder that containsxrd. If you unpacked the archive somewhere else, replacexrd/with the path to that folder.Check the name. Release 7.11.2 loads as
ios-xr/xrd-control-plane:7.11.2, which is the name the workshop labs use, so there is nothing to change:docker images ios-xr/xrd-control-planeIf your release loads under a name without a clear version, give it one, and use that name in your topologies:
docker tag <name from the Loaded image line> ios-xr/xrd-control-plane:<release>
Allow about 3 GB of disk for the 7.11.2 image. docker images reports between 1.3 and 2.7 GB, depending on the Docker version.
The workshop labs name the image ios-xr/xrd-control-plane:7.11.2. If you have another release, tag it with its own version and change the image: lines in the lab topology files to match.
Prepare the host
Advisory. Cisco recommends raising two Linux limits before you run XRd, because XRd needs far more inotify resources than the defaults give. inotify is the Linux feature that lets a program be told when a file changes, and the limits are shared by every container on the host. Containerlab’s XRd page gives the same advice and adds that with 10 or more XRd nodes you may need to raise them further. If you skip this, routers can fail to start, or restart repeatedly, and the XRd boot log shows inotify errors. Raise the limits once on the lab host, permanently:
sudo tee /etc/sysctl.d/90-xrd.conf > /dev/null <<'EOF'
fs.inotify.max_user_instances=64000
fs.inotify.max_user_watches=131072
EOF
sudo sysctl --systemThe first command makes the change survive a reboot, and sysctl --system applies it now. Check that the settings are active; the output should show 64000 and 131072:
sysctl fs.inotify.max_user_instances fs.inotify.max_user_watchesThese values run a 15-router XRd lab on the workshop host. Cisco’s xrd-tools repository has a host-check script that tests a host for XRd: run scripts/host-check -p xrd-control-plane -e docker from a clone of it.
| Setting | Value |
|---|---|
| Containerlab kind | cisco_xrd |
| Containerlab documentation | Cisco XRd kind |
| Login | clab / clab@123 |
| Interface names in the topology | Gi0-0-0-0, Gi0-0-0-1, … (IOS XR GigabitEthernet0/0/0/0, …) |
| Memory per node | about 1.6 GB in the workshop labs; allow 2.5 GB for routers that run routing protocols |
The clab login is created by the configuration Containerlab generates for XRd. If you give an XRd node your own startup-config, Containerlab uses your file instead, so include a user and SSH in it, or SSH to the node is refused:
username clab
group root-lr
group cisco-support
secret clab@123
!
line default
transport input ssh
!
ssh server v2
Route 4: build an image from a VM disk (vrnetlab)
Many vendors only ship their virtual routers as VM disks, usually .qcow2 files. vrnetlab wraps such a disk and a small QEMU virtual machine in a container image, so Containerlab can run it like any other node. Use the srl-labs fork; images built with the original project do not work with Containerlab.
Check that the host can run VMs
vrnetlab needs hardware virtualization (KVM):
sudo apt install -y cpu-checker
kvm-ok
ls -l /dev/kvmkvm-ok should report “KVM acceleration can be used”. On a cloud VM this needs nested virtualization or a bare-metal instance; Part 5 covers this for AWS.
Build an image (example: Cisco Catalyst 8000V)
git clone https://github.com/srl-labs/vrnetlab.git
cd vrnetlab/cisco/c8000v
cp ~/Downloads/c8000v-universalk9.17.11.01a.qcow2 .
make docker-image
docker images | grep c8000vEach platform has its own folder (cisco/, juniper/, nokia/ and so on) and a README with its exact steps. The image is named after the platform and the version in the disk’s file name. Check the name with docker images and use it in your topology.
| Setting (Catalyst 8000V) | Value |
|---|---|
| Containerlab kind | cisco_c8000v |
| Containerlab documentation | Cisco Catalyst 8000V kind and vrnetlab |
| Login | admin / admin |
| Resources per node | 1 vCPU and 4 GB by default |
| Boot time | about 5 minutes; watch with docker logs -f <container> |
VM-based nodes boot far more slowly and use more memory than native container images. Prefer a container image when the vendor offers one.
Test the image: a two-router XRd lab
The workshop repository has a lab with two XRd routers joined by one link. A small startup configuration gives each router an address on the link, so you can prove the image works end to end.
name: xrd-pair
topology:
nodes:
xrd1:
kind: cisco_xrd
image: ios-xr/xrd-control-plane:7.11.2
startup-config: xrd1.cfg
xrd2:
kind: cisco_xrd
image: ios-xr/xrd-control-plane:7.11.2
startup-config: xrd2.cfg
links:
# Gi0-0-0-0 here is GigabitEthernet0/0/0/0 inside the router.
- endpoints: ["xrd1:Gi0-0-0-0", "xrd2:Gi0-0-0-0"]See it drawn in the topology viewer.
xrd1.cfg is an IOS XR configuration that the router loads when it starts (xrd2.cfg is the same with xrd2, to xrd1 and 10.0.12.2):
hostname xrd1
username clab
group root-lr
group cisco-support
secret clab@123
!
line default
transport input ssh
!
lldp
!
interface GigabitEthernet0/0/0/0
description to xrd2
ipv4 address 10.0.12.1 255.255.255.252
!
ssh server v2
end
| Lines | What they do |
|---|---|
username clab to secret clab@123 |
Create the login you use over SSH |
line default, transport input ssh and ssh server v2 |
Turn on the SSH server |
lldp |
Lets the two routers discover each other |
interface GigabitEthernet0/0/0/0 |
Puts an address on the link. The topology file calls this interface Gi0-0-0-0 |
Deploy
First update your copy of the workshop files from Part 1, then deploy:
cd ~/dynanet-dev && git pull
cd ~/dynanet-dev/clab-workshop/labs/02-images
containerlab deploy -t xrd-pair.clab.ymlThe command finishes in a few seconds. It ends with a table listing clab-xrd-pair-xrd1 and clab-xrd-pair-xrd2, both running. IOS XR then needs about another minute to start and load its configuration, so wait a moment before you log in.
Verify
Log in to xrd1. The password is clab@123:
ssh clab@clab-xrd-pair-xrd1You get the IOS XR prompt, RP/0/RP0/CPU0:xrd1#. Run each check:
| Step | Command (on xrd1) | You should see |
|---|---|---|
| 1. Software | show version |
Cisco IOS XR Software, Version 7.11.2 and cisco XRd Control Plane |
| 2. Link up | show interfaces GigabitEthernet0/0/0/0 |
GigabitEthernet0/0/0/0 is up, line protocol is up |
| 3. Address | show ipv4 interface brief |
a row for GigabitEthernet0/0/0/0 with 10.0.12.1, Up and Up |
| 4. Neighbour | show lldp neighbors |
a row with Device ID xrd2 and Local Intf GigabitEthernet0/0/0/0 |
| 5. Reachability | ping 10.0.12.2 count 3 |
!!! and Success rate is 100 percent (3/3) |
Now check the other side from inside xrd2. Log in with ssh clab@clab-xrd-pair-xrd2 (password clab@123) and run the same steps with the mirrored values:
| Step | Command (on xrd2) | You should see |
|---|---|---|
| 1. Software | show version |
Cisco IOS XR Software, Version 7.11.2 |
| 2. Link up | show interfaces GigabitEthernet0/0/0/0 |
GigabitEthernet0/0/0/0 is up, line protocol is up |
| 3. Address | show ipv4 interface brief |
a row for GigabitEthernet0/0/0/0 with 10.0.12.2, Up and Up |
| 4. Neighbour | show lldp neighbors |
a row with Device ID xrd1 |
| 5. Reachability | ping 10.0.12.1 count 3 |
Success rate is 100 percent (3/3) |
Both routers must see each other: a link that works from one side only usually means a configuration mistake on the other.
Leave the router with exit. If SSH answers Connection refused or Connection timed out, or a check fails straight after the deploy, the router is still starting: wait 30 seconds and try again.
Or run all the checks at once from the lab folder:
./verify.shChecking lab xrd-pair
PASS xrd1 is running
PASS xrd2 is running
PASS xrd1 answers the CLI: IOS XR 7.11.2 LNT
PASS ssh clab-xrd-pair-xrd1 logs in as clab with the lab password
PASS ssh clab-xrd-pair-xrd2 logs in as clab with the lab password
PASS xrd1 GigabitEthernet0/0/0/0 is up
PASS xrd2 GigabitEthernet0/0/0/0 is up
PASS xrd1 sees xrd2 as an LLDP neighbour
PASS xrd1 pings xrd2 (10.0.12.1 -> 10.0.12.2), 100% success
PASS xrd2 pings xrd1 (10.0.12.2 -> 10.0.12.1), 100% success
All checks passed.
The script waits for the routers to finish starting before it checks them. Any FAIL line says what is wrong; the troubleshooting table below covers the usual causes.
Remove the lab
containerlab destroy -t xrd-pair.clab.yml --cleanup--cleanup also removes the lab folder clab-xrd-pair, where XRd keeps its files, so the next deploy starts fresh.
To try another image, change kind, image and the interface names to the values in that route’s table, and remove the startup-config lines: the two files are IOS XR configuration.
Move images between hosts
To prepare several lab hosts, download a vendor image once, then copy it:
docker save ios-xr/xrd-control-plane:7.11.2 | gzip > xrd-7.11.2.tar.gz # on the host that has it
scp xrd-7.11.2.tar.gz user@labhost: # copy it
docker load -i xrd-7.11.2.tar.gz # on the new hostCisco XRd and Arista cEOS images are covered by their vendors’ licence terms. Do not put them in a public Git repository, a public registry or a shared download link. Each attendee downloads them with their own account, or the instructor loads them onto hosts the training provides, as the licence allows. Git is the wrong place for images in any case: GitHub rejects files larger than 100 MB.
Troubleshooting
| Symptom | Fix |
|---|---|
Deploy fails with pull access denied or manifest unknown |
The image is not on the host and is not public. Load it first, and check the name in the topology matches docker images exactly, tag included |
docker load reports invalid tar header |
You passed the outer XRd archive. Unpack it first and load the .dockerv1.tgz file inside |
no space left on device while loading |
Free disk space: docker system df, then docker image prune to remove unused images |
| XRd node restarts or logs inotify errors | The sysctl limits are not applied. Check with sysctl fs.inotify.max_user_instances |
SSH to an XRd node answers Connection refused or Connection timed out just after a deploy |
IOS XR is still starting. Wait a minute and try again |
| SSH to an XRd node is refused although it has booted | Your own startup-config has no user or ssh server v2. Add them (see Route 3) and redeploy with --reconfigure |
Connection closed when you open SSH sessions to one router quickly, one after another |
IOS XR limits how fast new SSH sessions may start. Wait two seconds between them |
rm -rf clab-<lab> fails with Permission denied |
XRd writes files owned by root into the lab folder. Remove the lab with containerlab destroy --cleanup, or use sudo rm -rf clab-<lab> |
| vrnetlab node never finishes booting | KVM is missing. Check kvm-ok, and on a VM enable nested virtualization |
Next
Part 3 covers writing a topology file: nodes, kinds, links, startup configurations and management addresses.
Sources: Containerlab kinds · Cisco XRd · Arista cEOS · Linux container · Catalyst 8000V · vrnetlab · xrd-tools
Comments
Comments are reviewed before they appear.