Prepare a Mirror directory
By "-sandbox" option to specify a directory to run as a mirror directory.
$ sudo singularity -d build --sandbox ubuntu/ docker://ubuntu
Run and modify container
Run container on top of this image directory, where the need to use "-writable" option to make it writable.
$ sudo singularity shell --writable ubuntu/
# 在容器中运行 apt 安装程序来安装一些软件包,比如:安装vim
Singularity ubuntu:~> apt-get update
...
Singularity ubuntu:~> apt-get install vim
...
Mirrored
Exit container, and then use the build command to create a new container mirror.
$ sudo singularity build ubuntu-vim.simg ubuntu/
test
$ sudo singularity shell ubuntu-vim.simg
Singularity ubuntu-vim.simg:~> vim (运行vim检查镜像中是否包含安装的软件)