3. Share templates: push, pull, export

Publish a store entry to any OCI registry, or move it as an archive.

After this lesson you can

- Log in to a registry and push a store template - Pull it back on another host - Use export/import where there is no registry

Before you start: Build a template from installer media

vmlab template login ghcr.io -u <user> -p <token> reuses docker's credential store, then vmlab template push x86_64/linux-modern@1.0 ghcr.io/you/vmlab-templates/linux-modern uploads the disk as a chunked OCI artifact — multi-arch indexes assemble automatically when you push the same name from several arches. Consumers either template pull it or just reference it in vmlab.wcl.

Air-gapped? vmlab template export <ref> out.tar.zst writes a portable archive and vmlab template import loads it on the other side.

§ 1Exercise: Export / import round trip

Export the Alpine template to an archive, remove it from the store, and import it back.

console
vmlab template export x86_64/alpine-3.23 alpine.tar.zst
vmlab template rm x86_64/alpine-3.23@<version>
vmlab template import alpine.tar.zst
vmlab template list

Expected result

After the import, list shows the same x86_64/alpine-3.23@<version> entry again.

Hint

template rm requires the exact @<version> — copy it from vmlab template list. It refuses while clones back it; vmlab destroy the lesson lab first (or pass --force).