netlab
netlab copied to clipboard
Don't try to start the topology if the container image or Vagrant box is missing
We can use docker image ls --format json command and vagrant box list --machine-readable command to get the list of installed containers/boxes and then generate a warning (in 'netlab create') or an error (in 'netlab up') and refuse to start the lab.
The warning/error would be generated only if:
- The image used in the topology is unknown
- The device data contains box-building or container-building instructions URL (otherwise we're assuming the box/container will be downloaded, or the device is so poorly supported that it makes no sense to throw an error). The URL could point to anywhere, including (for example) containerlab documentation.
- The containerlab runtime is "docker" or "ignite". If someone feels like adding podman support, please submit a PR once this thing is merged into the dev branch.
Any thoughts/gotchas @jbemmel @ssasso @steffann @sdktr @petercrocker
Containerlab runs docker which will automatically pull any missing images. The issue only exists for platforms that don't provide a public image
I guess your second bullet would skip the error in that case - might be better to have an explicit 'error_if_missing_image' flag or something like that, as opposed to relying on the fact that there is no URL with details about the image
We're effectively saying the same thing. I'm saying "generate error if there's the URL pointing to the build documentation", you're saying "generate error if there's a flag".
I would like to provide a pointer with the error message (... and this is how you build the image), so every image with "error_if_missing" flag would hopefully have a URL, and having URL without that flag would be pointless.