Skip to content

Instantly share code, notes, and snippets.

Last active December 14, 2021 12:24
Show Gist options
  • Save umihico/bec2eba228a9f4118a296f4d34417a4b to your computer and use it in GitHub Desktop.
Save umihico/bec2eba228a9f4118a296f4d34417a4b to your computer and use it in GitHub Desktop.
my lima cofig
Host limadocker
HostName localhost
Port 60006
User lima
NoHostAuthenticationForLocalhost yes
export DOCKER_HOST=ssh://limadocker:60006
export DOCKER_DEFAULT_PLATFORM=linux/amd64
# 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=unix://$HOME/docker.sock
# $ docker ...
# This example requires Lima v0.7.3 or later
# CPUs: if you see performance issues, try limiting cpus to 1.
# Default: 4
cpus: 4
# Memory size
# Default: "4GiB"
memory: "16GiB"
# Disk size
# Default: "100GiB"
disk: "256GiB"
# Try to use a local image first.
- location: "~/Downloads/impish-server-cloudimg-amd64.img"
arch: "x86_64"
- location: "~/Downloads/impish-server-cloudimg-arm64.img"
arch: "aarch64"
# Download the file from the internet when the local file is missing.
# Hint: run `limactl prune` to invalidate the "current" cache
- location: ""
arch: "x86_64"
- location: ""
arch: "aarch64"
- location: "~"
writable: false
- location: "/tmp/lima"
writable: true
localPort: 60006
# Load ~/.ssh/*.pub in addition to $LIMA_HOME/_config/ , for allowing DOCKER_HOST=ssh:// .
# This option is enabled by default.
# If you have an insecure key under ~/.ssh, do not use this option.
loadDotSSHPubKeys: true
# containerd is managed by Docker, not by Lima, so the values are set to false here.
system: false
user: false
- mode: system
script: |
set -eux -o pipefail
apt update
command -v docker >/dev/null 2>&1 && exit 0
export DEBIAN_FRONTEND=noninteractive
curl -fsSL | sh
# NOTE: you may remove the lines below, if you prefer to use rootful docker, not rootless
systemctl disable --now docker
apt-get install -y uidmap dbus-user-session qemu-user-static binfmt-support
- mode: user
script: |
set -eux -o pipefail
systemctl --user start dbus install
docker context use rootless
mkdir -p $HOME/.docker/cli-plugins
curl -Lf -o $HOME/.docker/cli-plugins/docker-compose "$(curl --silent "" | grep '"tag_name":' | sed -E 's/.*"([^"]+)".*/\1/')/docker-compose-$(uname -s)-$(uname -m)"
chmod +x $HOME/.docker/cli-plugins/docker-compose
- script: |
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
if ! timeout 30s bash -c "until pgrep rootlesskit; do sleep 3; done"; then
echo >&2 "rootlesskit (used by rootless docker) is not running"
exit 1
hint: See "/var/log/cloud-init-output.log". in the guest
- guestSocket: "/run/user/{{.UID}}/docker.sock"
hostSocket: "{{.Home}}/docker.sock"
useHostResolver: false
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment