Takuma Yoneda

Singularity / Apptainer

Build from a local docker image

https://github.com/apptainer/singularity/issues/1537#issuecomment-557527638

singularity build <image_name.sif> docker-daemon://<docker_image>:<tag>

Another option is to transcribe Dockerfile to definition file:

# You need to pip install spython first
$ spython recipe Dockerfile &> Singularity.def

But I found it not to work properly.

Persistent Overlays

When I use mujoco_py (I still use MuJoCo v2.0), it attempts to create a lock file at /usr/local/lib/python3.8/dist-packages/mujoco_py/generated/mujocopy-buildlock, and fails with:

OSError: [Errno 30] Read-only file system: b'/usr/local/lib/python3.8/dist-packages/mujoco_py/generated/mujocopy-buildlock'

Previously I avoided this with Persistent Overlays.
Recently I've learned that by simply adding --writable-tmpfs at runtime is enough.
I can just do singularity run --writable-tmpfs d4rl.sif bash and mujoco_py works fine.

Issues I had:

How to copy an entire directory to singularity container at build time

https://groups.google.com/a/lbl.gov/g/singularity/c/4NFDsohnxgg?pli=1