Building custom container images
August 23, 2022, Joachim Folz
There is now a supported way to build container images defined by Dockerfile (or Containerfile) via podman and enroot. More below the fold.
Building custom container images #
Since users lack permissions to run docker commands they need an alternative solution to build images from scratch. Conveniently podman supports the Dockerfile syntax and enroot is able to import images built by podman.
First we need to start the new podman+enroot.sqsh
image so we
can build and import our image.
$ srun \
--container-image=/enroot/podman+enroot.sqsh \
--container-mounts=/dev/fuse:/dev/fuse,/netscratch/$USER:/netscratch/$USER,"`pwd`":"`pwd`" \
--container-workdir="`pwd`" \
--pty bash
The /dev/fuse
mount is strictly required for podman to work.
You may need to request more memory to build large images.
Inside the container you can now build and import the image as you please. Below are some basic example commands. Podman especially has many options to change the build process. Check the help pages for more details.
$ podman build . -t temp
$ export ENROOT_SQUASH_OPTIONS="-comp lz4 -Xhc -b 262144"
$ enroot import -o /netscratch/$USER/[name].sqsh podman://temp
These instructions have also been added to the Custom Software page. Please refer to that page for the most up to date information on building container images.