How to test a singularity image with –sandbox
In Hadez (acheron)
cd /opt/Carme/Carme-ContainerImages/Carme-Frontend-Container
- Build a sandbox:
singularity build --sandbox frontend/ frontend.recipe
-
Access the singularity container sandbox and modify your code:
singularity shell --writable frontend
-
Once you modify your code, exit the container (
Ctrl+D
) and build the image from the sandbox:singularity build /tmp/frontend.sif frontend
-
mv frontend.sif frontend.sif.bak && mv /tmp/frontend.sif .
-
systemctl restart carme-frontend
-
Verify your changes. If further testing is needed, repeat from step 3. No need to create the sandbox again
- Once you are done, copy your modifications to your host, .e.g., if
views.py
was modified, then:cp frontend/opt/Carme/Carme-Frontend/Carme-Django/webfrontend/carme/views.py /opt/Carme/Carme-Frontend/Carme-Django/webfrontend/carme/views.py
- Remove the sandbox, e.g.,
rm -r frontend
.
In Carme v1.0 (future release)
In the next release, singularity is saved in /opt/Carme/Carme-Vendors. Below we don’t create a backup file for easiness:
cd /opt/Carme/Carme-ContainerImages/Carme-Frontend-Container
/opt/Carme/Carme-Vendors/singularity/bin/singularity build --sandbox frontend/ frontend.recipe
/opt/Carme/Carme-Vendors/singularity/bin/singularity shell --writable frontend
/opt/Carme/Carme-Vendors/singularity/bin/singularity build frontend.sif frontend
systemctl restart carme-frontend