No, apptainer run does not automatically source ~/.bashrc like an interactive login shell would.
apptainer run
~/.bashrc
%runscript
.bashrc
apptainer shell
Explicitly source it in %runscript (for apptainer run):
# In your Singularity/Apptainer definition file: %runscript source ~/.bashrc && exec "$@"
Use BASH_ENV (for non-interactive Bash):
BASH_ENV
%environment export BASH_ENV=/path/to/your/bashrc
Switch to apptainer shell if you need an interactive environment with .bashrc loaded.
Mount and source manually:
apptainer run --bind ~/.bashrc:/root/.bashrc your_container.sif
(Then ensure the runscript sources it.)
For most cases, option 1 or 2 is the cleanest equivalent.
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