Created
October 29, 2021 09:21
-
-
Save anuraaga/2fe587848e318d664fe3a6543754fbec to your computer and use it in GitHub Desktop.
lima-docker
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Example to use Docker instead of containerd & nerdctl | |
# $ limactl start ./docker.yaml | |
# $ limactl shell docker docker run -it -v $HOME:$HOME --rm alpine | |
| |
# Hint: To allow `docker` CLI on the host to connect to the Docker daemon running inside the guest, | |
# add `NoHostAuthenticationForLocalhost yes` in ~/.ssh/config , and then run the following commands: | |
# $ export DOCKER_HOST=ssh://localhost:60006 | |
# $ docker ... | |
| |
# If ssh:// ... does not work, try the following commands: | |
# $ ssh -f -N -p 60006 -i ~/.lima/_config/user -o NoHostAuthenticationForLocalhost=yes -L $HOME/docker.sock:/run/user/$(id -u)/docker.sock 127.0.0.1 | |
# $ export DOCKER_HOST=unix://$HOME/docker.sock | |
# $ docker ... | |
| |
images: | |
# Hint: run `limactl prune` to invalidate the "current" cache | |
- location: "https://cloud-images.ubuntu.com/impish/current/impish-server-cloudimg-amd64.img" | |
arch: "x86_64" | |
- location: "https://cloud-images.ubuntu.com/impish/current/impish-server-cloudimg-arm64.img" | |
arch: "aarch64" | |
mounts: | |
- location: "~" | |
writable: false | |
- location: "/tmp/lima" | |
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 | |
script: | | |
#!/bin/bash | |
set -eux -o pipefail | |
command -v docker >/dev/null 2>&1 && exit 0 | |
export DEBIAN_FRONTEND=noninteractive | |
curl -fsSL https://get.docker.com | sh | |
echo '{"hosts": ["tcp://127.0.0.1:2375", "unix:///var/run/docker.sock"]}' > /etc/docker/daemon.json | |
mkdir -p /etc/systemd/system/docker.service.d/ | |
cat <<EOF | tee /etc/systemd/system/docker.service.d/override.conf | |
[Service] | |
ExecStart= | |
ExecStart=/usr/bin/dockerd | |
EOF | |
systemctl daemon-reload | |
systemctl restart docker.service | |
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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment