Files
lima/templates/apptainer-rootful.yaml
Anders F Björklund b48ec150da For apptainer, move TMPDIR away from tmpfs
It has some issues with it being mounted as "nodev",
so revert to using a normal file system for $TMPDIR.

Same as 22b4887683,
when the template was using Fedora instead of Ubuntu.

Also add comment about no tmpfs for APPTAINER_TMPDIR.

Signed-off-by: Anders F Björklund <anders.f.bjorklund@gmail.com>
2026-07-31 10:42:49 +02:00

39 lines
1.2 KiB
YAML

# A template to use Apptainer instead of containerd & nerdctl
# $ limactl start ./apptainer-rootful.yaml
# $ limactl shell apptainer-rootful apptainer run -u -B $HOME:$HOME docker://alpine
minimumLimaVersion: 2.0.0
base:
- template:_images/ubuntu-lts
- template:_default/mounts
containerd:
system: false
user: false
provision:
- mode: system
script: |
#!/bin/bash
set -eux -o pipefail
command -v apptainer >/dev/null 2>&1 && exit 0
# add the "Official PPA for Apptainer"
add-apt-repository -y ppa:apptainer/ppa
apt-get update
apt-get install -y apptainer-suid
# Ubuntu 24.10 moved /tmp over to tmpfs
# Apptainer wants a regular filesystem TMPDIR:
# - Building images has a problem with "nodev"
# - The image might be too big to fit in memory
echo "APPTAINER_TMPDIR=/var/tmp" > /etc/profile.d/apptainer.sh
echo "export APPTAINER_TMPDIR" > /etc/profile.d/apptainer.sh
probes:
- script: |
#!/bin/bash
set -eux -o pipefail
if ! timeout 30s bash -c "until command -v apptainer >/dev/null 2>&1; do sleep 3; done"; then
echo >&2 "apptainer is not installed yet"
exit 1
fi
hint: See "/var/log/cloud-init-output.log" in the guest