Hprc banner tamu.png

Difference between revisions of "Talk:SW:Singularity"

From TAMU HPRC
Jump to: navigation, search
(Latest)
(nearing in on objective)
Line 93: Line 93:
 
<pre>
 
<pre>
 
singularity image.create Fedora28-HPRCLAB.img # create .img file
 
singularity image.create Fedora28-HPRCLAB.img # create .img file
singularity image.expand -s 20480 Fedora28-HPRCLAB.img # expand to 20GB (works because there is no real file system yet [some ext3/4 systems have a problem?])
+
singularity image.expand -s 20480 Fedora28-HPRCLAB.img # expand to 20GB (works because there is no real filesystem yet [some ext3/4 systems see, to have a problem with expand?])
 
</pre>
 
</pre>
 
* Now import the sandbox into the image (with 20GB of storage)
 
* Now import the sandbox into the image (with 20GB of storage)
 
*  sudo tar -cvf - -C mysandbox/ . | sudo singularity image.import my20Gimage.img  # see the last/tar example in 'singularity image.import --help'
 
*  sudo tar -cvf - -C mysandbox/ . | sudo singularity image.import my20Gimage.img  # see the last/tar example in 'singularity image.import --help'

Revision as of 08:10, 11 August 2018

j-perdue random links for 8/10/2018

Placeholder

To be added to SW:Singlularity:Examples or something.... just a placeholder for now to dump all my URLs at home for access at work:

https://github.com/singularityware/singularity/issues/1076

https://github.com/singularityware/singularity/issues/1165

http://singularity.lbl.gov/quickstart#build-images-from-scratch

https://hub.docker.com/_/fedora/

https://github.com/NIH-HPC/singularity-examples/blob/master/torch/Singularity.torch

https://www.sylabs.io/docs/

history

  • random notes from .bash_history on hprclab2
[j-perdue@hprclab2 ~]$ history | grep docker
  460  git clone https://github.com/fedora-cloud/docker-brew-fedora.git
  466  less prep-docker-brew-branch.sh 
  468  ./prep-docker-brew-branch.sh 28
  470  sudo docker pull fedora:28
  472  sudo docker run --rm -ti fedora:28 bash
  484  sudo docker run  -ti fedora:28 bash
  494  sudo docker run  -ti fedora:28 bash
  495  man docker
  496  man docker-run
  497  sudo docker build --writable Fedora28.img fedora:28 
  515  sudo singularity build --writable FedoraLatest.img docker://fedora:latest
  516  sudo singularity build --writable Fedora28.img docker://fedora:28
  523  # sudo singularity build --writable --size Fedora28.img docker://fedora:28
  541  history | grep docker
[j-perdue@hprclab2 ~]$ history | grep singularit
  510  sudo singularity build --writable Fedora28.img fedora:28 
  511  sudo singularity build --writable Fedora28.img fedora:27
  512  sudo singularity build --writable Fedora28.img 
  XXX  sudo singularity shell --writable Fedora28-HPRCLAB.img

nearing in on objective

The objective in this case is a Fedora28-HPRCLAB.img file that has space for users to manuever around and install stuff:

  1. that we can provide to users, a Singularity .img file (self-contained), for them to update as needed (as root on their own workstations) that also runs on our clusters.
  2. is already populated with HPRCLAB RPMs
  3. has plenty of disk space for the user to add files (as non-root) while on the cluster
  4. Example below was created on HPRCLAB workstations.

Latest

  • create a Singularity sandbox from one of Fedora's Docker images
sudo singularity build --sandbox Fedora28-HPRCLAB.sandbox docker://fedora:28
  • create a list of packages to install into the image and place in /root. In this case we use the HPRCLAB/Fedora28 workstations current list of software. So on the workstation (not in the image):
sudo su - # need root for redirect
rpm -qa --qf "%{NAME}\n" | sort > /root/rpmlist

which results in something that looks like this:

[root@hprclab4 ~]# head /root/rpmlist
a2ps
a52dec
aajohan-comfortaa-fonts
aalib-libs
aalto-xml
abattis-cantarell-fonts
abrt-addon-coredump-helper
abrt-gui-libs
abrt-libs
accountsservice
  • open a sudo --writable shell in the sandbox (requires sudo for next steps)
sudo singularity shell --writable Fedora28-HPRCLAB.sandbox/
  • populate the sandbox with all the RPMs (we do them in groups at first in case there a problems and then do all to see what those problems were. (get a snack, take a walk... it can take awhile)
for x in {a..z} ; do
  dnf -y install `grep ^$x /root/rpmlist`
done
dnf -y install `cat /root/rpmlist`
  • add users
useradd mynetid 
  • once you are happy with the sandbox, it is time to make an .img file that provides space for the user to work in (e.g. download/install software). These steps do not require sudo since they don't really create anything in the image.
singularity image.create Fedora28-HPRCLAB.img # create .img file
singularity image.expand -s 20480 Fedora28-HPRCLAB.img # expand to 20GB (works because there is no real filesystem yet [some ext3/4 systems see, to have a problem with expand?])
  • Now import the sandbox into the image (with 20GB of storage)
  • sudo tar -cvf - -C mysandbox/ . | sudo singularity image.import my20Gimage.img # see the last/tar example in 'singularity image.import --help'