GitXplorerGitXplorer
k

apptainer-in-docker

public
43 stars
11 forks
3 issues

Commits

List of commits on branch main.
Verified
64002765555d3c0d411b49f5e8c5f17faf00cc6f

Fix for latest Docker version (#19)

ffasterius committed 2 months ago
Verified
4704b21d60458afe18483a32a62dd43b73fb9925

Apptainer version 1.2.0. (#17)

ggilmorera committed 8 months ago
Verified
d2486969c91927c211fb23a75b701e1bcd919525

fix url to linux foundation blog post

kkaczmarj committed a year ago
Verified
b72149a67bdaf66efd9d7470d68aa2fd26f6b4bc

Merge pull request #14 from peter-jansson/main

committed a year ago
Verified
fc249144f4f6316a27480bee6711904891025559

Apptainer version 1.2.0.

committed a year ago
Verified
c7e952186f1b9a986a6b10f313ce364e3a48cc3b

Merge pull request #13 from peter-jansson/main

committed 2 years ago

README

The README file for this repository.

Apptainer in Docker

Docker images available at kaczmarj/apptainer Docker pulls Docker pulls

The Dockerfile in this repository builds Apptainer. The resulting Docker image can be used on any system with Docker to build Apptainer images. This project is targeted towards high-performance computing users who have Apptainer/Singularity installed on their clusters but do not have Apptainer/Singularity on their local computers to build images.

Note: This project previously built Singularity. See the Linux Foundation post regarding the name change to Apptainer.

Convert local Docker image to Apptainer format

In the following example, we convert an existing Docker image to Apptainer format.

$ docker pull alpine:3.18.2
$ docker run --rm -v /var/run/docker.sock:/var/run/docker.sock -v $(pwd):/work \
    kaczmarj/apptainer build alpine_3.18.2.sif docker-daemon://alpine:3.18.2

This output .sif file will be owned by root, so you can change ownership:

sudo chown USER:GROUP alpine_3.18.2.sif

Build Apptainer image in Docker

With the following command, we build a small Apptainer image defined in test_alpine.def. This Apptainer image will be saved in the current directory myimage.sif.

$ docker run --rm --privileged -v $(pwd):/work kaczmarj/apptainer \
  build myimage.sif test_alpine.def

Run Apptainer image in Docker

One can run a Apptainer image within this Docker image. This is not recommended, but it is possible.

$ docker run --rm --privileged kaczmarj/apptainer \
  run shub://GodloveD/lolcow

Here is the output:

INFO:    Downloading shub image
87.6MiB / 87.6MiB [======================================================================================================================================================] 100 % 1.4 MiB/s 0s
 _________________________________________
/ He that is giddy thinks the world turns \
| round.                                  |
|                                         |
| -- William Shakespeare, "The Taming of  |
\ the Shrew"                              /
 -----------------------------------------
        \   ^__^
         \  (oo)\_______
            (__)\       )\/\
                ||----w |
                ||     ||

Build image

Apptainer version 1.2.0:

$ docker build --build-arg APPTAINER_COMMITISH=v1.2.0 -t apptainer:1.2.0 .

Bleeding-edge (main branch):

$ docker build --build-arg APPTAINER_COMMITISH=main -t apptainer:latest .