Skip to content

Simplify syntax for selecting images, with locations and digests #2418

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
afbjorklund opened this issue Jun 12, 2024 · 6 comments · Fixed by #3453
Closed

Simplify syntax for selecting images, with locations and digests #2418

afbjorklund opened this issue Jun 12, 2024 · 6 comments · Fixed by #3453

Comments

@afbjorklund
Copy link
Member

afbjorklund commented Jun 12, 2024

Description

Make the usage of Lima more similar to a Vagrantfile or a Dockerfile.

Vagrant.configure("2") do |config|
  config.vm.box = "cloud-image/ubuntu-24.04"
end

https://app.vagrantup.com/cloud-image

FROM ubuntu:24.04
# or, with a fully qualified registry
FROM docker.io/library/ubuntu:24.04

https://hub.docker.com/_/ubuntu

This by separating the usage of the images with the definition of the images.

templates/ubuntu.yaml

images:
- ubuntu-24.04

images/ubuntu-24.04.yaml

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/24.04/release-20240423/ubuntu-24.04-server-cloudimg-amd64.img"
  arch: "x86_64"
  digest: "sha256:32a9d30d18803da72f5936cf2b7b9efcb4d0bb63c67933f17e3bdfd1751de3f3"
- location: "https://cloud-images.ubuntu.com/releases/24.04/release-20240423/ubuntu-24.04-server-cloudimg-arm64.img"
  arch: "aarch64"
  digest: "sha256:c841bac00925d3e6892d979798103a867931f255f28fefd9d5e07e3e22d0ef22"
# Fallback to the latest release image.
# Hint: run `limactl prune` to invalidate the cache
- location: "https://cloud-images.ubuntu.com/releases/24.04/release/ubuntu-24.04-server-cloudimg-amd64.img"
  arch: "x86_64"
- location: "https://cloud-images.ubuntu.com/releases/24.04/release/ubuntu-24.04-server-cloudimg-arm64.img"
  arch: "aarch64"

The image can be shared with multiple templates, reducing the need for copy/paste of details.

@afbjorklund afbjorklund changed the title Simplify syntax for selecting images Simplify syntax for selecting images, with locations and digests Jun 12, 2024
@afbjorklund
Copy link
Member Author

The new limactl validate --fill will show a preview of the actual values.

@afbjorklund
Copy link
Member Author

Alternatively one could use something longer like image://ubuntu-24.04

@afbjorklund
Copy link
Member Author

Added default for the default image, for when you don't care about the OS

@afbjorklund
Copy link
Member Author

afbjorklund commented Jun 23, 2024

Also good when adding more optional fields to images - like size and cid*

* see https://docs.ipfs.tech/concepts/content-addressing/ for CID information

Example entry:

- location: "https://cloud-images.ubuntu.com/releases/24.04/release-20240423/ubuntu-24.04-server-cloudimg-amd64.img"
  size: 475004928
  arch: "x86_64"
  digest: "sha256:32a9d30d18803da72f5936cf2b7b9efcb4d0bb63c67933f17e3bdfd1751de3f3"
  cid: "bafybeig5sch22ecfox7gq724rz7uivydwvnnpuqdcnjz72iwelgtrakzui"

@afbjorklund
Copy link
Member Author

More architectures now in the default template, making "images" twice as long...

@jandubois
Copy link
Member

This is now possible with the base feature:

base: template://images/ubuntu-24.04

This is something we could implement right away with Lima 1.1.0, if we wanted to.

I've also written a little bit about how we could eventually have a single template per distro, and select the release via a --param setting in #2520 (reply in thread).

But that is still some way off and will need further discussion and refinement before we can figure out if that is a good idea or not.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants