Mirroring configuration file
Below Redis database, for example, talk about the main difference% startscript and% runscript of.
Look below redis.def profile
Bootstrap:library
From: ubuntu:18.04
%help
Redis 5.0.0 for Ubuntu
%post
apt-get update
apt-get install -y wget build-essential
wget http://download.redis.io/releases/redis-5.0.0.tar.gz
tar xzf redis-5.0.0.tar.gz
cd redis-5.0.0
make
%startscript
/redis-5.0.0/src/redis-server
%runscript
/redis-5.0.0/src/redis-cli
among them:
- % Startscript are commands that run when the container starts, see the following: Start Redis Server
- % Runscript means execute the command to run when the container, or directly run the command executed by the container run sub-mirror, see below: Run Redis Client
- DETAILED DESCRIPTION profile, can refer to: https://sylabs.io/guides/3.2/user-guide/definition_files.html
Mirrored
Mirrored requires root privileges, so use sudo to execute the following command.
$ sudo singularity build redis.sif redis.def
Mirroring
Start Redis Server
Start Redis Server will call% startscript to start the Redis Server.
$ singularity instance start redis.sif redis
INFO: instance started successfully
Run Redis Client
Run Redis Client calls% runscript to run Redis Client.
# 通过 run 子命令运行 Redis Client
$ singularity run redis.sif
127.0.0.1:6379> ?
# 通过直接执行镜像来运行 Redis Client
$ ./redis.sif
127.0.0.1:6379>