Skip to content

Instantly share code, notes, and snippets.

@carlosonunez
Created December 28, 2021 23:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save carlosonunez/c2dd48ae33e7ac38ba066cffba790c28 to your computer and use it in GitHub Desktop.
Save carlosonunez/c2dd48ae33e7ac38ba066cffba790c28 to your computer and use it in GitHub Desktop.
lima-vm-troubleshooting
arch: default
images:
- location: "~/Downloads/impish-server-cloudimg-amd64.img"
arch: "x86_64"
- location: "~/Downloads/impish-server-cloudimg-arm64.img"
arch: "aarch64"
- location: https://github.com/lima-vm/alpine-lima/releases/download/v0.2.3/alpine-lima-rd-3.14.3-aarch64.iso
arch: "aarch64"
digest: "sha512:277d2140f9c8adb2d1777103c6ce69cc079375d66944f8745d6f786216e3a7b197e813384a6c113b3fdf78e4f65bb129b997f358819daa2a3af113b1caab0dba"
- location: https://github.com/lima-vm/alpine-lima/releases/download/v0.2.3/alpine-lima-rd-3.14.3-x86_64.iso
arch: "x86_64"
digest: "sha512:d690b10c0948f2e3f7b74322c2407827e972b9440d922bc7a1ad27c55ebefea2cdaeae0edf87b239199e460364b2b81dfe8314c534ac92af6fc93999bfcf3062"
cpus: 4
memory: 8GiB
disk: 50GiB
mounts:
- location: "~/src"
writable: true
- location: "~/tmp"
writable: true
# NOTE: Replace /var/folders/qp/kttdvnk15x1ch4w958nwdwcm0000gn/T/ with your actual temporary directory as provided by
# the $TMPDIR environment variable.
- location: "/var/folders/qp/kttdvnk15x1ch4w958nwdwcm0000gn/T/"
writable: true
- location: "/tmp/lima"
writable: true
- location: "~/.config"
writable: true
- location: "~/.lima"
writable: false
ssh:
localPort: 10000
loadDotSSHPubKeys: true
forwardAgent: false
containerd:
system: false
user: false
provision:
- mode: system
script: |
#!/bin/bash
set -eux -o pipefail
# Add our user into the 'docker' group so that we don't have to sudo
usermod -aG docker $LIMA_CIDATA_USER
# Start Docker
/etc/init.d/docker start
# Fix clock drift by syncing with host
max_attempts=5
attempts=0
until docker run --rm --privileged alpine hwclock -s
do
attempts=$((attempts+1))
echo "WARNING: Unable to sync clock with host; trying again in 1 second"
sleep 1
done
# Enable multi-arch support
# If you need support for other architectures like s90x or PPC,
# run the command below manually and provide the target arch at the end
if uname -m | grep -Eiq 'aarch|arm'
then docker run --rm --privileged aptman/qus -s -- -p x86_64
else docker run --rm --privileged aptman/qus -s -- -p arm
fi
probes:
- script: |
#!/bin/bash
set -eux -o pipefail
if ! timeout 30s bash -c "until command -v docker ps >/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
firmware:
legacyBIOS: true
video:
display: "none"
propagateProxyEnv: true
useHostResolver: true
portForwards:
- guestSocket: "/var/run/docker.sock"
hostSocket: "{{.Home}}/.lima/docker.sock"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment