The %post section in Apptainer .def files runs as /bin/sh by default, which does not support Bash arrays ((...) and ${array[@]}).
%post
.def
/bin/sh
(...)
${array[@]}
Add a shebang as the first line of %post:
%post + #!/bin/bash apt update packages=( htop vim ) apt install -y "${packages[@]}"
%post apt update - packages=( - htop - vim - ) - apt install -y "${packages[@]}" + apt install -y htop vim
or with a space-separated string:
%post apt update + packages="htop vim" + apt install -y $packages
Use Option 1 if you need arrays; otherwise, Option 2 is simpler and more portable.
This is a shared conversation and may include unverified content that doesn't reflect Mistral AI's views. Login to resume chatting.
Vibe can make mistakes. Check answers. Learn more