7.2 Container Usage¶
7.2.1 Overview¶
Apptainer is a lightweight container virtualization technology widely used on high-performance computing platforms. It provides operating-system-level virtualization. hep_container is a container client tool for the IHEP computing cluster, developed on top of Apptainer container management commands. It helps users work with multiple operating system versions and runtime environments.
Note: All commands in this document must be run on an lxlogin login node. The commands are located in the following directory. It is recommended that you add this directory to your personal PATH environment variable.
7.2.2 Command Reference¶
The hep_container command mainly provides three operations: images, shell, and exec. You can use the help option on the command line to view usage instructions and examples.
$ ./hep_container help
Usage : ./hep_container <command> [command options...]
CONTAINER USAGE COMMANDS:
shell Run a Bourne shell within container image
exec Execute a command within container image
images List Support container images
groups List Support groups
-g groupname With a specific group name
EXAMPLES:
./hep_container images
./hep_container groups
./hep_container shell SL5
./hep_container shell SL5 -g physics
./hep_container exec SL5 cat /etc/redhat-release
./hep_container exec SL5 python ./yourprograme.py
./hep_container exec SL5 -g physics cat /etc/redhat-release
7.2.2.1 View Supported Images¶
Command format: hep_container images
This command lists the operating system container images currently provided.
$ hep_container images
Hep_container support images:
SL5 : Scientific Linux 5
SL6 : Scientific Linux 6
SL7 : Scientific Linux 7
7.2.2.2 View Supported User Groups or Experiment Groups¶
Command format: hep_container groups
This command lists the user groups or experiment groups currently supported by the container command. Use the -g option to specify a user group or experiment group. The corresponding user directory and experiment directory are mounted inside the container. If -g is not specified, the primary group is used by default.
$ hep_container groups
Hep_container support groups:
u07|atlas|atlasrun|comet|offline|physics|higgs|ams|cms|dyw|hxmt|polars|juno|argo|lhaaso|
7.2.2.3 Enter a Container Environment¶
Command format: hep_container shell [container image]
This command starts a shell inside the specified container, allowing interactive operations between the host and the container. Run exit to leave the shell.
The following example starts an SL5 operating system image. After startup, the user is in an SL5 system environment.
$ hep_container shell SL5
Apptainer: Invoking an interactive shell within container...
Apptainer> cat /etc/redhat-release
Scientific Linux SL release 5.5 (Boron)
Apptainery> exit
exit
7.2.2.4 Execute Commands Inside a Container¶
Command format: hep_container exec [container image] [command]
This command runs the specified command inside the specified container from the external host.
The following example runs an SL5 command on lxlogin using the SL5 environment and prints the result.
7.2.2.5 Group Option¶
Users from different experiment groups will have the corresponding experiment data disks mounted after entering the container.
If the -g group option is not specified, the experiment data disk for the user's primary group is mounted by default. The -g option can take one or multiple groups. Multiple groups are separated with :.
View your group information first. The first gid is usually the primary group.
[user@lxlogin-002 ~]$ id liming
uid=60020(liming) gid=600(u07) groups=600(u07),290(physics),1004(juno)
hep_container shell SL5 -g physics
hep_container shell SL6 -g juno:dyw
7.2.3 Notes¶
Due to the AFS password authentication version, users currently cannot obtain AFS tokens automatically when logging in to lxlogin. If an error similar to the following appears after logging in to lxlogin:
Run klog first, and then run the container commands.
FAQ¶
See FAQ.
有问题?输入后跳转到对话页继续交流