LoginSignup
1
2

SingularityコンテナをWSL2上に構築しました。構築環境はSingularityの公式サイトの記述に基づき、Ubuntu 22.04上とします。
参考となるドキュメントは https://docs.sylabs.io/guides/latest/admin-guide/installation.html#installation-on-windows-or-mac に存在します。このドキュメントに従えば、Singularity 4.0.0がインストールされます。

手順としては以下の通りになります。

wget https://github.com/sylabs/singularity/releases/download/v4.0.0/singularity-ce_4.0.0-jammy_amd64.deb
sudo apt install ./singularity-ce_4.0.0-jammy_amd64.deb

まず、Singularity 4.0.0のUbuntu 22.04用のdebファイルを取得します。しかる後に、debファイルをaptコマンドでインストールします。当方で実行したときにはいくつか気になるメッセージが出力されていましたがインストール自体は行われているようです。以下のメッセージの表示理由等は未解明です。

N: Download is performed unsandboxed as root as file '/home/gorn/singularity-ce_4.0.0-jammy_amd64.deb' couldn't be accessed by user '_apt'. - pkgAcquire::Run (13: Permission denied)

さて、Singularityがインストールできたので確認してみます。

以下のファイルをex001.defとして作成します。

Bootstrap: docker
From: ubuntu:22.04

%post
    apt-get -y update
    apt-get -y upgrade

%runscript
    echo "Hello, Ubuntu"

以下のコマンドでビルドします。

singularity build ubuntu.sif ex001.def

Ubuntu 22.04のイメージとなります。

Shellでコンテナの中に入ってみます。

singularity shell ubuntu.sif

とりあえず、動きは確認できました。

1
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
2