%runscript echo "This is what happens when you run the container..." bash %setup # 1)这一步可以先设置好环境变量,通过wget等下载好必要的软件库等,注意这些指令都只是在host机器上运行,不是container里面。 # 内容请参考https://git.oschina.net/sg-ai/singularityimages/blob/master/keras-tf-1.0.1-gpu.setup %post # non interactive debian DEBIAN_FRONTEND=noninteractive # Install the necessary packages (from repo) apt-get update && apt-get install -y --no-install-recommends curl ca-certificates
GLOBAL OPTIONS: -d --debug Print debugging information -h --help Display usage summary -q --quiet Only print errors --version Show application version -v --verbose Increase verbosity +1 -x --sh-debug Print shell wrapper debugging information
GENERAL COMMANDS: help Show additional help for a command
CONTAINER USAGE COMMANDS: exec Execute a command within container run Launch a runscript within container shell Run a Bourne shell within container test Execute any test code defined within container
CONTAINER MANAGEMENT COMMANDS (requires root): bootstrap Bootstrap a new Singularity image from scratch copy Copy files from your host into the container create Create a new container image expand Grow the container image export Export the contents of a container via a tar pipe import Import/add container contents via a tar pipe mount Mount a Singularity container image
Obtain a shell (/bin/sh) within the container image.
note: When invoking a shell within a container, the container image is by default writable.
SHELL OPTIONS: -B/--bind <spec> A user-bind path specification. spec can either be a path or a src:dest pair, specifying the bind mount to perform (can be called multiple times) -c/--contain This option disables the automatic sharing of writable filesystems on your host (e.g. $HOME and /tmp). -C/--containall Contain not only file systems, but also PID and IPC -H/--home <path> Path to a different home directory to virtualize within the container -i/--ipc Run container in a new IPC namespace -p/--pid Run container in a new PID namespace (creates child) --pwd Initial working directory for payload process inside the container -S/--scratch <path> Include a scratch directory within the container that is linked to a temporary dir (use -W to force location) -s/--shell <shell> Path to program to use for interactive shell -u/--user Try to run completely unprivileged (only works on very new kernels/distros) -W/--workdir Working directory to be used for /tmp, /var/tmp and $HOME (if -c/--contain was also used) -w/--writable By default all Singularity containers are available as read only. This option makes the file system accessible as read/write.
NOTE: If there is a daemon process running inside the container, then subsequent container commands will all run within the same namespaces. This means that the --writable and --contain options will not be honored as the namespaces have already been configured by the 'singularity start' command.