How to install Python or R in an apptainer?

459 Views Asked by At

I am new to docker and using apptainer for that.

the def file is: firstApp.def:

`Bootstrap: docker
From: ubuntu:22.04

%environment
    export LC_ALL=C
`

then I built it as follows and I want it to be writable (I hope I am not so naive), so I can install some packages later:

`apptainer build --sandbox --fakeroot firstApp.sif firstApp.def
`

now I do not know how to install Python3 (preferably, 3.8 or later).

I tried to add the following command lines to the def file:

`%post
   apt-get -y install update
   apt-get -y install python3.8 `

it raises these errors as well even without "apt-get -y install python3.8":

Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
E: Unable to locate package update
FATAL:   While performing build: while running engine: exit status 100
1

There are 1 best solutions below

0
On

This work for me %post

apt-get update && apt-get install -y netcat python3.8