Skip to content

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_containeris 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 anlxloginlogin node. The commands are located in the following directory. It is recommended that you add this directory to your personalPATHenvironment variable.

/cvmfs/container.ihep.ac.cn/bin/

7.2.2 Command Reference

Thehep_containercommand mainly provides three operations:images,shell, andexec. You can use thehelpoption on the command line to view usage instructions and examples.

$./hep_containerhelpUsage:./hep_container[commandoptions...]CONTAINERUSAGECOMMANDS:shellRunaBourneshellwithincontainerimageexecExecuteacommandwithincontainerimageimagesListSupportcontainerimagesgroupsListSupportgroups-ggroupnameWithaspecificgroupnameEXAMPLES:./hep_containerimages./hep_containergroups./hep_containershellSL5./hep_containershellSL5-gphysics./hep_containerexecSL5cat/etc/redhat-release./hep_containerexecSL5python./yourprograme.py./hep_containerexecSL5-gphysicscat/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_containerimagesHep_containersupportimages:SL5:ScientificLinux5SL6:ScientificLinux6SL7:ScientificLinux7

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-goption to specify a user group or experiment group. The corresponding user directory and experiment directory are mounted inside the container. If-gis not specified, the primary group is used by default.

$hep_containergroupsHep_containersupportgroups: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. Runexitto leave the shell.

The following example starts an SL5 operating system image. After startup, the user is in an SL5 system environment.

$hep_containershellSL5Apptainer:Invokinganinteractiveshellwithincontainer...Apptainer>cat/etc/redhat-releaseScientificLinuxSLrelease5.5(Boron)Apptainery>exitexit

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 onlxloginusing the SL5 environment and prints the result.

$hep_containerexecSL5cat/etc/redhat-releaseScientificLinuxSLrelease5.5(Boron)

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-ggroup option is not specified, the experiment data disk for the user's primary group is mounted by default. The-goption can take one or multiple groups. Multiple groups are separated with:.

View your group information first. The firstgidis usually the primary group.

[user@lxlogin-002~]$idliminguid=60020(liming)gid=600(u07)groups=600(u07),290(physics),1004(juno)hep_containershellSL5-gphysicshep_containershellSL6-gjuno:dyw

7.2.3 Notes

Due to the AFS password authentication version, users currently cannot obtain AFS tokens automatically when logging in tolxlogin. If an error similar to the following appears after logging in tolxlogin:

mkdir: cannot create directory '/afs/ihep.ac.cn/users/z/zhengw/.Xauthority': Permission denied

Runklogfirst, and then run the container commands.

FAQ

SeeFAQ.

AI 助手
快速提问 ×

有问题?输入后跳转到对话页继续交流

Baidu
map