Skip to content

Latest commit

 

History

History
48 lines (35 loc) · 1.01 KB

apptainer_cheat.adoc

File metadata and controls

48 lines (35 loc) · 1.01 KB

apptainer Apptainer [former singularity]

1. install

2. build a container

apptainer build graph

3. examples

3.1. ssh

Warning
logging through ssh will not trigger all the apptainer run/shell/exec mecanics (eg. /.singularity/actions/shell/
my_container.def
Bootstrap: docker
From: ubuntu:22.04

%appinstall ssh
    apt update && apt install -y openssh-server
    sed -i "s/UsePam yes/UsePam no/g" /etc/ssh/sshd_config
	echo "/.singularity/actions/shell" > /etc/ssh/sshrc

%apprun sshd
    /usr/sbin/sshd -p 2222 -D
shell
$> apptainer build my_container.sif my_container.def
$> apptainer instance start --bind $HOME/.ssh/id_rsa.pub:$HOME/.ssh/authorized_keys my_container.sif my_container
$> apptainer run --app ssh instance://my_container
# some ssh 127.0.0.1
$> apptainer instace stop my_container