macOS 上的 Apptainer

问题描述 投票:0回答:1

我想将 apptainer 用于 macOS 上的特定程序。我已经通过lima安装了apptainer。然而,虽然apptainer是我的路径,但我仍然无法使用它。

这就是我现在的路径:

/users/-myname-/.lima/apptainer:/Users/-myname-/.lima/bin:/opt/homebrew
等等

但是使用apptainer命令后,仍然给出:command not found:apptainer

有人可以帮助我在 macOS 上执行 apptainer 吗?

apptainer
1个回答
0
投票

如何在 MacBook 上使用 Apptainer?

在配备 M1/2/3 处理器的 MacBook 上,您必须在虚拟机内运行

apptainer
。您可以使用
lima
来实现这一点。 首先,你必须安装
lima

警告:由于 CPU 不兼容,您可能无法在其他架构上使用 MacBook 上构建的容器。

1.安装利马

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
brew install qemu lima

2.创建虚拟机

limactl create --name=apptainer template://apptainer

3.使主目录可写

为了能够构建容器,您需要授予

lima
对主目录的写入权限。

vi ~/.lima/apptainer/lima.yml

并改变

mounts:
  - location: "~"
  - location: "/tmp/lima"
    writable: true

mounts:
  - location: "~"
    writeable: true
  - location: "/tmp/lima"
    writable: true

4.启动虚拟机

limactl start apptainer

5.进入虚拟机

limactl shell apptainer

6.在虚拟机内您可以正常运行
apptainer

apptainer
>>>
Usage:
  apptainer [global options...] <command>

Available Commands:
  build       Build an Apptainer image
  cache       Manage the local cache
  capability  Manage Linux capabilities for users and groups
  checkpoint  Manage container checkpoint state (experimental)
  completion  Generate the autocompletion script for the specified shell
  config      Manage various apptainer configuration (root user only)
  delete      Deletes requested image from the library
  exec        Run a command within a container
  inspect     Show metadata for an image
  instance    Manage containers running as services
  key         Manage OpenPGP keys
  keyserver   Manage apptainer keyservers
  oci         Manage OCI containers
  overlay     Manage an EXT3 writable overlay image
  plugin      Manage Apptainer plugins
  pull        Pull an image from a URI
  push        Upload image to the provided URI
  registry    Manage authentication to OCI/Docker registries
  remote      Manage apptainer remote endpoints
  run         Run the user-defined default command within a container
  run-help    Show the user-defined help for an image
  search      Search a Container Library for images
  shell       Run a shell within a container
  sif         Manipulate Singularity Image Format (SIF) images
  sign        Add digital signature(s) to an image
  test        Run the user-defined tests within a container
  verify      Verify digital signature(s) within an image
  version     Show the version for Apptainer

Run 'apptainer --help' for more detailed usage information.

参考文献

  • Apptainer(以前称为 Singularity)简化了容器的创建和执行,确保封装软件组件以实现可移植性和可重复性。
  • Lima推出具有自动文件共享和端口转发功能的Linux虚拟机(类似于WSL2)。
© www.soinside.com 2019 - 2024. All rights reserved.