Singularity安装和使⽤
⼀、基本介绍
Singularity使⽤户能够完全控制其操作系统环境。这意味着⽤户可以将主机上的操作系统“交换”给其他⼈。因此,如果主机系统运⾏RHEL6,但是您的应⽤程序在Ubuntu中运⾏,则可以创建⼀个Ubuntu映像,将应⽤程序安装到该映像中,将映像复制到另⼀个主机,并在该主机的本机Ubuntu环境中运⾏应⽤程序,总的来说Singularity类似于Docker。Singularity允许利⽤所在宿主机的资源。这包括HPC 互连,资源管理器,⽂件系统,GPU和/或加速器等。 Singularity和Docker优缺点对⽐
⼆、安装
Ubuntu:
sudo apt-get update && sudo apt-get install python dh-autoreconf build-essential
Centos:
sudo yum update && sudo yum groupinstall 'Development Tools'
# clone可以选择release版本进⾏安装
一对象的图片表情包$ git clone github/singularityware/singularity.git
$ cd singularity
$ ./autogen.sh
$ ./configure --prefix=/usr/local --sysconfdir=/etc
$ make
$ sudo make install韩国服务器和日本服务器
三、创建镜像
$ singularity create container.img
Initializing Singularity image subsystem
python做一些有趣的Opening image file: container.img
Creating 768MiB image
Binding image to loop
Creating file system within image
Image is done: container.img
默认创建镜像⼤⼩是768M,也可以指定⼤⼩进⾏创建
$ singularity create --size 2048 container2.img
停止setinterval循环计时器方法
Initializing Singularity image subsystem
Opening image file: container2.img
Creating 2048MiB image
Binding image to loop
Creating file system within image
Image is done: container2.img
四、定制化镜像
创建TensorFlow gpu 版本定制镜像
1. create a bootstrap new file
vim Singularity
BootStrap: docker
From: nvidia/cuda:8.0-cudnn5-devel-centos7
%post
# install other needed packages
yum clean all
yum -y update
yum -y install epel-release
yum -y install python-pip
centos和ubuntu# install tensorflow
pip install --upgrade pip
pip install tensorflow-gpu
$singularity create --size 10240 centos.img
Initializing Singularity image subsystem
Opening image file: centos.img
Creating 10240MiB image
flowable使用自己的表单
Binding image to loop
Creating file system within image
Image is done: centos.img
3.customize image
$ sudo singularity  bootstrap centos.img Singularity
Sanitizing environment
Building from bootstrap definition recipe
Adding base Singularity environment to container
Docker image path: index.docker.io/library/ubuntu:latest
Cache folder set to /root/.singularity/docker
[5/5] |===================================| 100.0%
Exploding layer: sha256:b Exploding layer: sha256:5 Exploding layer: sha256:2 Exploding layer: sha256:3deef3fcbd3072b45771bd0d192d4e5ff2b7310b99ea92bce062e010********. Exploding layer: sha256:c Exploding layer: sha256:f Finalizin
g Singularity container
五、进⼊容器⾥⾯
$singularity shell -n centos.img
WARNING: Library bind directory not present in container, update container Singularity: Invoking an interactive shell
Filesystem      Size  Used Avail Use% Mounted on
singularity    1.0M    0  1.0M  0% /
六、共享⽂件
/test 是宿主机⽬录,/yangyang是容器内部⽬录,容器内部⽬录不需要提前创建
$singularity shell -B /test:/yangyang centos.img
Singularity: Invoking an interactive shell

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。