Created
March 26, 2022 17:12
-
-
Save Sparker0i/8a5a699c2dd387b9a54ea1256b485c83 to your computer and use it in GitHub Desktop.
Custom YAML to run Podman inside a Lima VM
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
# This example requires Lima v0.7.0 or later. | |
images: | |
- location: "https://download.fedoraproject.org/pub/fedora/linux/releases/35/Cloud/x86_64/images/Fedora-Cloud-Base-35-1.2.x86_64.qcow2" | |
arch: "x86_64" | |
digest: "sha256:fe84502779b3477284a8d4c86731f642ca10dd3984d2b5eccdf82630a9ca2de6" | |
- location: "https://download.fedoraproject.org/pub/fedora/linux/releases/35/Cloud/aarch64/images/Fedora-Cloud-Base-35-1.2.aarch64.qcow2" | |
arch: "aarch64" | |
digest: "sha256:c71f2e6ce75b516d565e2c297ea9994c69b946cb3eaa0a4bbea400dbd6f59ae6" | |
cpus: 4 | |
memory: 6 GiB | |
disk: 20 GiB | |
mounts: | |
- location: "~" | |
- location: "/tmp/lima" | |
writable: true | |
containerd: | |
system: false | |
user: false | |
provision: | |
- mode: system | |
script: | | |
#!/bin/bash | |
dnf copr enable rhcontainerbot/podman4 -y | |
dnf update | |
dnf install -y podman crun | |
- mode: user | |
script: | | |
#!/bin/bash | |
set -eux -o pipefail | |
systemctl --user enable --now podman.socket | |
probes: | |
- script: | | |
#!/bin/bash | |
set -eux -o pipefail | |
if ! timeout 30s bash -c "until command -v podman >/dev/null 2>&1; do sleep 3; done"; then | |
echo >&2 "podman is not installed yet" | |
exit 1 | |
fi | |
hint: See "/var/log/cloud-init-output.log". in the guest | |
portForwards: | |
- guestSocket: "/run/user/{{.UID}}/podman/podman.sock" | |
hostSocket: "{{.Dir}}/sock/podman.sock" | |
message: | | |
To run `podman` on the host (assumes podman-remote is installed), run the following commands: | |
------ | |
export CONTAINER_HOST=$(limactl list podman --format 'unix://{{.Dir}}/sock/podman.sock') | |
podman system connection add lima "unix://{{.Dir}}/sock/podman.sock" | |
podman system connection default lima | |
podman{{if eq .HostOS "linux"}} --remote{{end}} run quay.io/podman/hello | |
------ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment