Skip to content

Commit 96d7c67

Browse files
committed
Refactor Ubuntu images into base templates
Also adds template://default/mounts to setup the default mounts globally. Signed-off-by: Jan Dubois <jan.dubois@suse.com>
1 parent 56702e0 commit 96d7c67

File tree

15 files changed

+59
-301
lines changed

15 files changed

+59
-301
lines changed

.github/workflows/test.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,8 @@ jobs:
196196
- name: Validate jsonschema
197197
run: make schema-limayaml.json
198198
- name: Validate templates
199-
run: find -L templates -name '*.yaml' | xargs limactl validate
199+
# Can't validate base templates in `_default` because they have no images
200+
run: find -L templates -name '*.yaml' ! -path '*/_default/*' | xargs limactl validate
200201
- name: Install test dependencies
201202
# QEMU: required by Lima itself
202203
# bash: required by test-templates.sh (OS version of bash is too old)

cmd/limactl/start.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -374,7 +374,10 @@ func createStartActionCommon(cmd *cobra.Command, _ []string) (exit bool, err err
374374
if templates, err := templatestore.Templates(); err == nil {
375375
w := cmd.OutOrStdout()
376376
for _, f := range templates {
377-
_, _ = fmt.Fprintln(w, f.Name)
377+
// don't show internal base templates like `_default/*`
378+
if !strings.HasPrefix(f.Name, "_") {
379+
_, _ = fmt.Fprintln(w, f.Name)
380+
}
378381
}
379382
return true, nil
380383
}

templates/apptainer-rootful.yaml

Lines changed: 5 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2,24 +2,11 @@
22
# $ limactl start ./apptainer-rootful.yaml
33
# $ limactl shell apptainer-rootful apptainer run -u -B $HOME:$HOME docker://alpine
44

5-
images:
6-
# Try to use release-yyyyMMdd image if available. Note that release-yyyyMMdd will be removed after several months.
7-
- location: "https://cloud-images.ubuntu.com/releases/noble/release-20250313/ubuntu-24.04-server-cloudimg-amd64.img"
8-
arch: "x86_64"
9-
digest: "sha256:eacac65efe9e9bae0cbcb3f9d5c2b5e8c5313fa78a3bc401c3fb28b2d48cefc0"
10-
- location: "https://cloud-images.ubuntu.com/releases/noble/release-20250313/ubuntu-24.04-server-cloudimg-arm64.img"
11-
arch: "aarch64"
12-
digest: "sha256:103f31c5a5b7f031a60ce3555c8fbd56317fd8ffbaaa7e17002879e6157d546d"
13-
# Fallback to the latest release image.
14-
# Hint: run `limactl prune` to invalidate the cache
15-
- location: "https://cloud-images.ubuntu.com/releases/noble/release/ubuntu-24.04-server-cloudimg-amd64.img"
16-
arch: "x86_64"
17-
- location: "https://cloud-images.ubuntu.com/releases/noble/release/ubuntu-24.04-server-cloudimg-arm64.img"
18-
arch: "aarch64"
19-
mounts:
20-
- location: "~"
21-
- location: "/tmp/lima"
22-
writable: true
5+
minimumLimaVersion: "1.1.0"
6+
base:
7+
- template://_images/ubuntu-lts.yaml
8+
- template://_default/mounts.yaml
9+
2310
containerd:
2411
system: false
2512
user: false

templates/apptainer.yaml

Lines changed: 5 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2,24 +2,11 @@
22
# $ limactl start ./apptainer.yaml
33
# $ limactl shell apptainer apptainer run -u -B $HOME:$HOME docker://alpine
44

5-
images:
6-
# Try to use release-yyyyMMdd image if available. Note that release-yyyyMMdd will be removed after several months.
7-
- location: "https://cloud-images.ubuntu.com/releases/noble/release-20250313/ubuntu-24.04-server-cloudimg-amd64.img"
8-
arch: "x86_64"
9-
digest: "sha256:eacac65efe9e9bae0cbcb3f9d5c2b5e8c5313fa78a3bc401c3fb28b2d48cefc0"
10-
- location: "https://cloud-images.ubuntu.com/releases/noble/release-20250313/ubuntu-24.04-server-cloudimg-arm64.img"
11-
arch: "aarch64"
12-
digest: "sha256:103f31c5a5b7f031a60ce3555c8fbd56317fd8ffbaaa7e17002879e6157d546d"
13-
# Fallback to the latest release image.
14-
# Hint: run `limactl prune` to invalidate the cache
15-
- location: "https://cloud-images.ubuntu.com/releases/noble/release/ubuntu-24.04-server-cloudimg-amd64.img"
16-
arch: "x86_64"
17-
- location: "https://cloud-images.ubuntu.com/releases/noble/release/ubuntu-24.04-server-cloudimg-arm64.img"
18-
arch: "aarch64"
19-
mounts:
20-
- location: "~"
21-
- location: "/tmp/lima"
22-
writable: true
5+
minimumLimaVersion: "1.1.0"
6+
base:
7+
- template://_images/ubuntu-lts.yaml
8+
- template://_default/mounts.yaml
9+
2310
containerd:
2411
system: false
2512
user: false

templates/buildkit.yaml

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -10,20 +10,10 @@ message: |
1010
export BUILDKIT_HOST="unix://{{.Dir}}/sock/buildkitd.sock"
1111
buildctl debug workers
1212
-------
13-
images:
14-
# Try to use release-yyyyMMdd image if available. Note that release-yyyyMMdd will be removed after several months.
15-
- location: "https://cloud-images.ubuntu.com/releases/noble/release-20250313/ubuntu-24.04-server-cloudimg-amd64.img"
16-
arch: "x86_64"
17-
digest: "sha256:eacac65efe9e9bae0cbcb3f9d5c2b5e8c5313fa78a3bc401c3fb28b2d48cefc0"
18-
- location: "https://cloud-images.ubuntu.com/releases/noble/release-20250313/ubuntu-24.04-server-cloudimg-arm64.img"
19-
arch: "aarch64"
20-
digest: "sha256:103f31c5a5b7f031a60ce3555c8fbd56317fd8ffbaaa7e17002879e6157d546d"
21-
# Fallback to the latest release image.
22-
# Hint: run `limactl prune` to invalidate the cache
23-
- location: "https://cloud-images.ubuntu.com/releases/noble/release/ubuntu-24.04-server-cloudimg-amd64.img"
24-
arch: "x86_64"
25-
- location: "https://cloud-images.ubuntu.com/releases/noble/release/ubuntu-24.04-server-cloudimg-arm64.img"
26-
arch: "aarch64"
13+
14+
minimumLimaVersion: "1.1.0"
15+
base: template://_images/ubuntu-lts.yaml
16+
2717
containerd:
2818
system: false
2919
user: true

templates/docker-rootful.yaml

Lines changed: 5 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -6,25 +6,11 @@
66
# $ export DOCKER_HOST=$(limactl list docker-rootful --format 'unix://{{.Dir}}/sock/docker.sock')
77
# $ docker ...
88

9-
# This template requires Lima v0.20.0 or later
10-
images:
11-
# Try to use release-yyyyMMdd image if available. Note that release-yyyyMMdd will be removed after several months.
12-
- location: "https://cloud-images.ubuntu.com/releases/noble/release-20250313/ubuntu-24.04-server-cloudimg-amd64.img"
13-
arch: "x86_64"
14-
digest: "sha256:eacac65efe9e9bae0cbcb3f9d5c2b5e8c5313fa78a3bc401c3fb28b2d48cefc0"
15-
- location: "https://cloud-images.ubuntu.com/releases/noble/release-20250313/ubuntu-24.04-server-cloudimg-arm64.img"
16-
arch: "aarch64"
17-
digest: "sha256:103f31c5a5b7f031a60ce3555c8fbd56317fd8ffbaaa7e17002879e6157d546d"
18-
# Fallback to the latest release image.
19-
# Hint: run `limactl prune` to invalidate the cache
20-
- location: "https://cloud-images.ubuntu.com/releases/noble/release/ubuntu-24.04-server-cloudimg-amd64.img"
21-
arch: "x86_64"
22-
- location: "https://cloud-images.ubuntu.com/releases/noble/release/ubuntu-24.04-server-cloudimg-arm64.img"
23-
arch: "aarch64"
24-
mounts:
25-
- location: "~"
26-
- location: "/tmp/lima"
27-
writable: true
9+
minimumLimaVersion: "1.1.0"
10+
base:
11+
- template://_images/ubuntu-lts.yaml
12+
- template://_default/mounts.yaml
13+
2814
# containerd is managed by Docker, not by Lima, so the values are set to false here.
2915
containerd:
3016
system: false

templates/docker.yaml

Lines changed: 5 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -6,25 +6,11 @@
66
# $ export DOCKER_HOST=$(limactl list docker --format 'unix://{{.Dir}}/sock/docker.sock')
77
# $ docker ...
88

9-
# This template requires Lima v0.8.0 or later
10-
images:
11-
# Try to use release-yyyyMMdd image if available. Note that release-yyyyMMdd will be removed after several months.
12-
- location: "https://cloud-images.ubuntu.com/releases/noble/release-20250313/ubuntu-24.04-server-cloudimg-amd64.img"
13-
arch: "x86_64"
14-
digest: "sha256:eacac65efe9e9bae0cbcb3f9d5c2b5e8c5313fa78a3bc401c3fb28b2d48cefc0"
15-
- location: "https://cloud-images.ubuntu.com/releases/noble/release-20250313/ubuntu-24.04-server-cloudimg-arm64.img"
16-
arch: "aarch64"
17-
digest: "sha256:103f31c5a5b7f031a60ce3555c8fbd56317fd8ffbaaa7e17002879e6157d546d"
18-
# Fallback to the latest release image.
19-
# Hint: run `limactl prune` to invalidate the cache
20-
- location: "https://cloud-images.ubuntu.com/releases/noble/release/ubuntu-24.04-server-cloudimg-amd64.img"
21-
arch: "x86_64"
22-
- location: "https://cloud-images.ubuntu.com/releases/noble/release/ubuntu-24.04-server-cloudimg-arm64.img"
23-
arch: "aarch64"
24-
mounts:
25-
- location: "~"
26-
- location: "/tmp/lima"
27-
writable: true
9+
minimumLimaVersion: "1.1.0"
10+
base:
11+
- template://_images/ubuntu-lts.yaml
12+
- template://_default/mounts.yaml
13+
2814
# containerd is managed by Docker, not by Lima, so the values are set to false here.
2915
containerd:
3016
system: false

templates/faasd.yaml

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -24,20 +24,9 @@ message: |
2424
faas-cli store deploy NodeInfo
2525
------
2626
27-
images:
28-
# Try to use release-yyyyMMdd image if available. Note that release-yyyyMMdd will be removed after several months.
29-
- location: "https://cloud-images.ubuntu.com/releases/noble/release-20250313/ubuntu-24.04-server-cloudimg-amd64.img"
30-
arch: "x86_64"
31-
digest: "sha256:eacac65efe9e9bae0cbcb3f9d5c2b5e8c5313fa78a3bc401c3fb28b2d48cefc0"
32-
- location: "https://cloud-images.ubuntu.com/releases/noble/release-20250313/ubuntu-24.04-server-cloudimg-arm64.img"
33-
arch: "aarch64"
34-
digest: "sha256:103f31c5a5b7f031a60ce3555c8fbd56317fd8ffbaaa7e17002879e6157d546d"
35-
# Fallback to the latest release image.
36-
# Hint: run `limactl prune` to invalidate the cache
37-
- location: "https://cloud-images.ubuntu.com/releases/noble/release/ubuntu-24.04-server-cloudimg-amd64.img"
38-
arch: "x86_64"
39-
- location: "https://cloud-images.ubuntu.com/releases/noble/release/ubuntu-24.04-server-cloudimg-arm64.img"
40-
arch: "aarch64"
27+
minimumLimaVersion: "1.1.0"
28+
base: template://_images/ubuntu-lts.yaml
29+
4130
# Mounts are disabled in this template, but can be enabled optionally.
4231
mounts: []
4332

templates/k3s.yaml

Lines changed: 3 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -9,23 +9,10 @@
99
# $ kubectl get no
1010
# NAME STATUS ROLES AGE VERSION
1111
# lima-k3s Ready control-plane,master 69s v1.21.1+k3s1
12-
#
13-
# This template requires Lima v0.7.0 or later.
1412

15-
images:
16-
# Try to use release-yyyyMMdd image if available. Note that release-yyyyMMdd will be removed after several months.
17-
- location: "https://cloud-images.ubuntu.com/releases/noble/release-20250313/ubuntu-24.04-server-cloudimg-amd64.img"
18-
arch: "x86_64"
19-
digest: "sha256:eacac65efe9e9bae0cbcb3f9d5c2b5e8c5313fa78a3bc401c3fb28b2d48cefc0"
20-
- location: "https://cloud-images.ubuntu.com/releases/noble/release-20250313/ubuntu-24.04-server-cloudimg-arm64.img"
21-
arch: "aarch64"
22-
digest: "sha256:103f31c5a5b7f031a60ce3555c8fbd56317fd8ffbaaa7e17002879e6157d546d"
23-
# Fallback to the latest release image.
24-
# Hint: run `limactl prune` to invalidate the cache
25-
- location: "https://cloud-images.ubuntu.com/releases/noble/release/ubuntu-24.04-server-cloudimg-amd64.img"
26-
arch: "x86_64"
27-
- location: "https://cloud-images.ubuntu.com/releases/noble/release/ubuntu-24.04-server-cloudimg-arm64.img"
28-
arch: "aarch64"
13+
minimumLimaVersion: "1.1.0"
14+
base: template://_images/ubuntu-lts.yaml
15+
2916
# Mounts are disabled in this template, but can be enabled optionally.
3017
mounts: []
3118

templates/k8s.yaml

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -10,21 +10,9 @@
1010
# NAME STATUS ROLES AGE VERSION
1111
# lima-k8s Ready control-plane,master 44s v1.22.3
1212

13-
# This template requires Lima v0.20.0 or later.
14-
images:
15-
# Try to use release-yyyyMMdd image if available. Note that release-yyyyMMdd will be removed after several months.
16-
- location: "https://cloud-images.ubuntu.com/releases/noble/release-20250313/ubuntu-24.04-server-cloudimg-amd64.img"
17-
arch: "x86_64"
18-
digest: "sha256:eacac65efe9e9bae0cbcb3f9d5c2b5e8c5313fa78a3bc401c3fb28b2d48cefc0"
19-
- location: "https://cloud-images.ubuntu.com/releases/noble/release-20250313/ubuntu-24.04-server-cloudimg-arm64.img"
20-
arch: "aarch64"
21-
digest: "sha256:103f31c5a5b7f031a60ce3555c8fbd56317fd8ffbaaa7e17002879e6157d546d"
22-
# Fallback to the latest release image.
23-
# Hint: run `limactl prune` to invalidate the cache
24-
- location: "https://cloud-images.ubuntu.com/releases/noble/release/ubuntu-24.04-server-cloudimg-amd64.img"
25-
arch: "x86_64"
26-
- location: "https://cloud-images.ubuntu.com/releases/noble/release/ubuntu-24.04-server-cloudimg-arm64.img"
27-
arch: "aarch64"
13+
minimumLimaVersion: "1.1.0"
14+
base: template://_images/ubuntu-lts.yaml
15+
2816
# Mounts are disabled in this template, but can be enabled optionally.
2917
mounts: []
3018
containerd:

0 commit comments

Comments
 (0)