-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathlima_machine.yaml
116 lines (113 loc) · 4.19 KB
/
lima_machine.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
# Example to use Docker instead of containerd & nerdctl
# $ limactl start ./docker.yaml
# $ limactl shell docker docker run -it -v $HOME:$HOME --rm alpine
# To run `docker` on the host (assumes docker-cli is installed):
# $ export DOCKER_HOST=$(limactl list docker --format 'unix://{{.Dir}}/sock/docker.sock')
# $ docker ...
# This example requires Lima v0.8.0 or later
cpus: 4
memory: 8GiB
disk: 50GiB
ssh:
localPort: 10000
loadDotSSHPubKeys: true
forwardAgent: false
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-20221201/ubuntu-22.04-server-cloudimg-amd64.img"
arch: "x86_64"
digest: "sha256:8a814737df484d9e2f4cb2c04c91629aea2fced6799fc36f77376f0da91dba65"
- location: "https://cloud-images.ubuntu.com/releases/22.04/release-20221201/ubuntu-22.04-server-cloudimg-arm64.img"
arch: "aarch64"
digest: "sha256:8a0477adcbdadefd58ae5c0625b53bbe618aedfe69983b824da8d02be0a8c961"
# Fallback to the latest release image.
# Hint: run `limactl prune` to invalidate the cache
- location: "https://cloud-images.ubuntu.com/releases/22.04/release/ubuntu-22.04-server-cloudimg-amd64.img"
arch: "x86_64"
- location: "https://cloud-images.ubuntu.com/releases/22.04/release/ubuntu-22.04-server-cloudimg-arm64.img"
arch: "aarch64"
mounts:
- location: "~/src"
writable: true
- location: "~/tmp"
writable: true
# NOTE: Replace %TEMPDIR% with your actual temporary directory as provided by
# the $TMPDIR environment variable.
- location: "%TEMPDIR%"
writable: true
- location: "/tmp/lima"
writable: true
- location: "~/.config"
writable: true
- location: "~/.docker"
writable: true
- location: "~/.lima"
writable: false
- location: "~/.kube"
writable: true
- location: "~/.ssh"
writable: false
- location: "~/.gnupg"
writable: false
- location: "~/.aws"
writable: true
- location: "~/.azure"
writable: true
# containerd is managed by Docker, not by Lima, so the values are set to false here.
containerd:
system: false
user: false
provision:
- mode: system
# This script defines the host.docker.internal hostname when hostResolver is disabled.
# It is also needed for lima 0.8.2 and earlier, which does not support hostResolver.hosts.
# Names defined in /etc/hosts inside the VM are not resolved inside containers when
# using the hostResolver; use hostResolver.hosts instead (requires lima 0.8.3 or later).
script: |
#!/bin/sh
sed -i 's/host.lima.internal.*/host.lima.internal host.docker.internal/' /etc/hosts
- mode: system
script: |
#!/bin/bash
set -eux -o pipefail
command -v docker >/dev/null 2>&1 && exit 0
if [ ! -e /etc/systemd/system/docker.socket.d/override.conf ]; then
mkdir -p /etc/systemd/system/docker.socket.d
# Alternatively we could just add the user to the "docker" group, but that requires restarting the user session
cat <<-EOF >/etc/systemd/system/docker.socket.d/override.conf
[Socket]
SocketUser=${LIMA_CIDATA_USER}
EOF
fi
export DEBIAN_FRONTEND=noninteractive
curl -fsSL https://get.docker.com | sh
curl -fsSL https://get.docker.com | sh
- mode: system
script: |
#!/bin/bash
# Increase inotify limits to prevent nested Kubernetes control planes
# from crash looping.
set -eux -o pipefail
grep -q 'fs.inotify.max_user_watches = 524288' /etc/sysctl.conf || echo 'fs.inotify.max_user_watches = 524288' >> /etc/sysctl.conf
grep -q 'fs.inotify.max_user_instances = 512' /etc/sysctl.conf || echo 'fs.inotify.max_user_instances = 512' >> /etc/sysctl.conf
sysctl --system
- mode: system
script: |
sudo chmod 666 /var/run/docker.sock
- mode: system
script: |
docker run --rm --privileged aptman/qus -s -- -p x86_64
probes:
- script: |
#!/bin/bash
set -eux -o pipefail
if ! timeout 30s bash -c "until command -v docker >/dev/null 2>&1; do sleep 3; done"; then
echo >&2 "docker is not installed yet"
exit 1
fi
hint: See "/var/log/cloud-init-output.log". in the guest
hostResolver:
enabled: false
portForwards:
- guestSocket: /var/run/docker.sock
hostSocket: "{{.Home}}/.lima/docker.sock"