lima-vm / lima

Linux virtual machines, with a focus on running containers
https://lima-vm.io/
Apache License 2.0
15.14k stars 591 forks source link

Inherit system images and share them between examples #824

Closed afbjorklund closed 5 days ago

afbjorklund commented 2 years ago

Description

For instance Vagrant had this concept of boxes, where you would hide complexity under a name.

https://www.vagrantup.com/docs/boxes

It has the same problems of central control and what not as the yaml files themselves do, though.

https://app.vagrantup.com/ubuntu/boxes/focal64

Side note: it was only for VirtualBox, the others were https://app.vagrantup.com/generic/boxes/ubuntu2004 But it doesn't matter for this discussion, it was supposed to just reference the official Ubuntu cloud image...


But the idea of reducing the OS definition to a single line, would still be a useful concept ?

Instead of:

images:
# Try to use release-yyyyMMdd image if available. Note that release-yyyyMMdd will be removed after several months.
- location: "https://cloud-images.ubuntu.com/releases/22.04/release-20220420/ubuntu-22.04-server-cloudimg-amd64.img"
  arch: "x86_64"
  digest: "sha256:de5e632e17b8965f2baf4ea6d2b824788e154d9a65df4fd419ec4019898e15cd"
- location: "https://cloud-images.ubuntu.com/releases/22.04/release-20220420/ubuntu-22.04-server-cloudimg-arm64.img"
  arch: "aarch64"
  digest: "sha256:66224c7fed99ff5a5539eda406c87bbfefe8af6ff6b47d92df3187832b5b5d4f"

One would just say "ubuntu-22.04-20220420" (or something).

images:
- location: "https://download.fedoraproject.org/pub/fedora/linux/releases/35/Cloud/x86_64/images/Fedora-Cloud-Base-35-1.2.x86_64.qcow2"
  arch: "x86_64"
  digest: "sha256:fe84502779b3477284a8d4c86731f642ca10dd3984d2b5eccdf82630a9ca2de6"
- location: "https://download.fedoraproject.org/pub/fedora/linux/releases/35/Cloud/aarch64/images/Fedora-Cloud-Base-35-1.2.aarch64.qcow2"
  arch: "aarch64"
  digest: "sha256:c71f2e6ce75b516d565e2c297ea9994c69b946cb3eaa0a4bbea400dbd6f59ae6"

This would be "fedora-35-1.2", and similar lookups for the rest.

Currently it is all copy/paste, between the different examples.

AkihiroSuda commented 2 years ago

You can already use limactl start template://ubuntu, limactl start template://fedora, ...

Does this satisfy your requirement?

afbjorklund commented 2 years ago

It is not a requirement, it was more of a feature that could be used in docker or k8s or similar.

Like how the nerdctl archives are predefined, and you only need to say "true" or "false"

afbjorklund commented 2 years ago

Not sure what the best yaml engineering would be, just that it looks a bit redundant at the moment.

examples/buildkit.yaml: digest: "sha256:de5e632e17b8965f2baf4ea6d2b824788e154d9a65df4fd419ec4019898e15cd" examples/default.yaml: digest: "sha256:de5e632e17b8965f2baf4ea6d2b824788e154d9a65df4fd419ec4019898e15cd" examples/docker.yaml: digest: "sha256:de5e632e17b8965f2baf4ea6d2b824788e154d9a65df4fd419ec4019898e15cd" examples/faasd.yaml: digest: "sha256:de5e632e17b8965f2baf4ea6d2b824788e154d9a65df4fd419ec4019898e15cd" examples/k3s.yaml: digest: "sha256:de5e632e17b8965f2baf4ea6d2b824788e154d9a65df4fd419ec4019898e15cd" examples/k8s.yaml: digest: "sha256:de5e632e17b8965f2baf4ea6d2b824788e154d9a65df4fd419ec4019898e15cd" examples/podman.yaml: digest: "sha256:de5e632e17b8965f2baf4ea6d2b824788e154d9a65df4fd419ec4019898e15cd" examples/ubuntu-lts.yaml: digest: "sha256:de5e632e17b8965f2baf4ea6d2b824788e154d9a65df4fd419ec4019898e15cd" examples/ubuntu.yaml: digest: "sha256:de5e632e17b8965f2baf4ea6d2b824788e154d9a65df4fd419ec4019898e15cd" examples/vmnet.yaml: digest: "sha256:de5e632e17b8965f2baf4ea6d2b824788e154d9a65df4fd419ec4019898e15cd"

afbjorklund commented 5 days ago

Closed as duplicate of #2418, which has an implementation of the yaml engineering

images:
- ubuntu-22.04