saladi
saladi

Reputation: 3253

singularity extract, edit, and rebuild image

I have a singularity container that has been made for me (to run tensorflow on comet GPU nodes) but I need to modify the keras install for my purposes.

I understand that .simg files are not editable (and that the writable .img format is deprecated), so the process of converting to an .img file, editing, and then converting back to .simg is discouraged:

sudo singularity build --writable development.img production.simg
## make changes
sudo singularity build production2.img development.simg

It seems to me the best way might be to extract the contents (say into a sandbox), edit them, and then rebuild the sandbox into an .simg image.

I know how to do the second conversion (singularity build new-sif sandbox), but how can I do the first?

I have tried the following, but the command never finishes:

sudo singularity build tf_gpu tensorflow-gpu.simg
WARNING: Authentication token file not found : Only pulls of public images will succeed
Build target already exists. Do you want to overwrite? [N/y] y
2018/10/12 08:39:54 bufio.Scanner: token too long
INFO:    Starting build...

Upvotes: 9

Views: 6385

Answers (1)

LucasBoatwright
LucasBoatwright

Reputation: 1696

You can easily convert between a sandbox and a production build using the following:

sudo singularity build lolcow.sif docker://godlovedc/lolcow  # pulls and builds an example container

sudo singularity build --sandbox lolcow_sandbox/ lolcow.sif # converts from container to a writable sandbox

sudo singularity build lolcow2 lolcow_sandbox/ # converts from sandbox to container

So, you can edit the sandbox and then rebuild accordingly.

Upvotes: 12

Related Questions