Skip to content

Commit 1c69497

Browse files
committed
templates: add podman-rootful
Signed-off-by: Anders F Björklund <[email protected]>
1 parent a6bece1 commit 1c69497

File tree

2 files changed

+71
-0
lines changed

2 files changed

+71
-0
lines changed

examples/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ Container engines:
2222
- [`docker.yaml`](./docker.yaml): Docker
2323
- [`docker-rootful.yaml`](./docker-rootful.yaml): Docker (rootful)
2424
- [`podman.yaml`](./podman.yaml): Podman
25+
- [`podman-rootful.yaml`](./podman-rootful.yaml): Podman (rootful)
2526
- [`singularity.yaml`](./singularity.yaml): Singularity
2627
- LXD is installed in the default Ubuntu template, so there is no `lxd.yaml`
2728

examples/podman-rootful.yaml

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
# Example to use Podman instead of containerd & nerdctl
2+
# $ limactl start ./podman-rootful.yaml
3+
# $ limactl shell podman-rootful sudo podman run -it -v $HOME:$HOME --rm docker.io/library/alpine
4+
5+
# To run `podman` on the host (assumes podman-remote is installed):
6+
# $ export CONTAINER_HOST=$(limactl list podman-rootful --format 'unix://{{.Dir}}/sock/podman.sock')
7+
# $ podman --remote ...
8+
9+
# To run `docker` on the host (assumes docker-cli is installed):
10+
# $ export DOCKER_HOST=$(limactl list podman-rootful --format 'unix://{{.Dir}}/sock/podman.sock')
11+
# $ docker ...
12+
13+
# This example requires Lima v0.8.0 or later
14+
images:
15+
- location: "https://download.fedoraproject.org/pub/fedora/linux/releases/36/Cloud/x86_64/images/Fedora-Cloud-Base-36-1.5.x86_64.qcow2"
16+
arch: "x86_64"
17+
digest: "sha256:ca9e514cc2f4a7a0188e7c68af60eb4e573d2e6850cc65b464697223f46b4605"
18+
- location: "https://download.fedoraproject.org/pub/fedora/linux/releases/36/Cloud/aarch64/images/Fedora-Cloud-Base-36-1.5.aarch64.qcow2"
19+
arch: "aarch64"
20+
digest: "sha256:5c0e7e99b0c542cb2155cd3b52bbf51a42a65917e52d37df457d1e9759b37512"
21+
22+
mounts:
23+
- location: "~"
24+
- location: "/tmp/lima"
25+
writable: true
26+
containerd:
27+
system: false
28+
user: false
29+
provision:
30+
- mode: system
31+
script: |
32+
#!/bin/bash
33+
set -eux -o pipefail
34+
command -v podman >/dev/null 2>&1 && exit 0
35+
if [ ! -e /etc/systemd/system/podman.socket.d/override.conf ]; then
36+
mkdir -p /etc/systemd/system/podman.socket.d
37+
cat <<-EOF >/etc/systemd/system/podman.socket.d/override.conf
38+
[Socket]
39+
SocketUser=${LIMA_CIDATA_USER}
40+
EOF
41+
fi
42+
if [ ! -e /etc/tmpfiles.d/podman.conf ]; then
43+
mkdir -p /etc/tmpfiles.d
44+
echo "d /run/podman 0700 ${LIMA_CIDATA_USER} -" > /etc/tmpfiles.d/podman.conf
45+
fi
46+
dnf -y install podman
47+
- mode: system
48+
script: |
49+
#!/bin/bash
50+
set -eux -o pipefail
51+
systemctl --system enable --now podman.socket
52+
probes:
53+
- script: |
54+
#!/bin/bash
55+
set -eux -o pipefail
56+
if ! timeout 30s bash -c "until command -v podman >/dev/null 2>&1; do sleep 3; done"; then
57+
echo >&2 "podman is not installed yet"
58+
exit 1
59+
fi
60+
hint: See "/var/log/cloud-init-output.log" in the guest
61+
portForwards:
62+
- guestSocket: "/run/podman/podman.sock"
63+
hostSocket: "{{.Dir}}/sock/podman.sock"
64+
message: |
65+
To run `podman` on the host (assumes podman-remote is installed), run the following commands:
66+
------
67+
podman system connection add lima-{{.Name}} "unix://{{.Dir}}/sock/podman.sock"
68+
podman system connection default lima-{{.Name}}
69+
podman{{if eq .HostOS "linux"}} --remote{{end}} run quay.io/podman/hello
70+
------

0 commit comments

Comments
 (0)