Unverified Commit 8ff79600 authored by Pascal Roth's avatar Pascal Roth Committed by GitHub

Checks docker version before building singularity image (#402)

# Description

For the cluster deployment, the latest docker version (25.xx) is not yet
compatible with the latest apptainer version. This PR adds a check
before building the singularity image and adds a warning to the docs.
Also the NOHTTPS warning has been resolved.

Fixes #371 

## Type of change

- Bug fix (non-breaking change which fixes an issue)
- This change requires a documentation update

## Checklist

- [x] I have run the [`pre-commit` checks](https://pre-commit.com/) with
`./orbit.sh --format`
- [x] I have made corresponding changes to the documentation
- [x] My changes generate no new warnings
- [ ] I have added tests that prove my fix is effective or that my
feature works
- [ ] I have run all the tests with `./orbit.sh --test` and they pass
- [ ] I have updated the changelog and the corresponding version in the
extension's `config/extension.toml` file
- [x] I have added my name to the `CONTRIBUTORS.md` or my name already
exists there

---------
Signed-off-by: 's avatarPascal Roth <57946385+pascal-roth@users.noreply.github.com>
Co-authored-by: 's avatarMayank Mittal <12863862+Mayankm96@users.noreply.github.com>
parent 7a967894
...@@ -44,6 +44,21 @@ install_apptainer() { ...@@ -44,6 +44,21 @@ install_apptainer() {
fi fi
} }
# Function to check docker versions
# If docker version is more than 25, the script errors out.
check_docker_version() {
# Retrieve Docker version
docker_version=$(docker --version | awk '{ print $3 }')
apptainer_version=$(apptainer --version | awk '{ print $3 }')
# Check if version is above 25.xx
if [ "$(echo "${docker_version}" | cut -d '.' -f 1)" -ge 25 ]; then
echo "[ERROR]: Docker version ${docker_version} is not compatible with Apptainer version ${apptainer_version}. Exiting."
exit 1
else
echo "[INFO]: Building singularity with docker version: ${docker_version} and Apptainer version: ${apptainer_version}."
fi
}
#== #==
# Main # Main
...@@ -116,6 +131,8 @@ case $mode in ...@@ -116,6 +131,8 @@ case $mode in
if ! command -v apptainer &> /dev/null; then if ! command -v apptainer &> /dev/null; then
install_apptainer install_apptainer
fi fi
# Check if Docker version is greater than 25
check_docker_version
# Check if .env file exists # Check if .env file exists
if [ -f $SCRIPT_DIR/.env ]; then if [ -f $SCRIPT_DIR/.env ]; then
# source env file to get cluster login and path information # source env file to get cluster login and path information
...@@ -125,7 +142,7 @@ case $mode in ...@@ -125,7 +142,7 @@ case $mode in
mkdir -p /$SCRIPT_DIR/exports mkdir -p /$SCRIPT_DIR/exports
# create singularity image # create singularity image
cd /$SCRIPT_DIR/exports cd /$SCRIPT_DIR/exports
SINGULARITY_NOHTTPS=1 apptainer build --sandbox orbit.sif docker-daemon://orbit:latest APPTAINER_NOHTTPS=1 apptainer build --sandbox orbit.sif docker-daemon://orbit:latest
# tar image and send to cluster # tar image and send to cluster
tar -cvf /$SCRIPT_DIR/exports/orbit.tar orbit.sif tar -cvf /$SCRIPT_DIR/exports/orbit.tar orbit.sif
scp /$SCRIPT_DIR/exports/orbit.tar $CLUSTER_LOGIN:$CLUSTER_SIF_PATH/orbit.tar scp /$SCRIPT_DIR/exports/orbit.tar $CLUSTER_LOGIN:$CLUSTER_SIF_PATH/orbit.tar
......
...@@ -44,8 +44,15 @@ development machine and the cluster. Such a connection will simplify the file tr ...@@ -44,8 +44,15 @@ development machine and the cluster. Such a connection will simplify the file tr
the user cluster password from being requested multiple times. the user cluster password from being requested multiple times.
.. attention:: .. attention::
The workflow has been tested with ``apptainer version 1.2.5-1.el7``. There have been reported binding issues with The workflow has been tested with ``apptainer version 1.2.5-1.el7`` and ``docker version 24.0.7``.
previous versions (such as ``apptainer version 1.1.3-1.el7``). Please ensure that you are using the latest version.
- ``apptainer``:
There have been reported binding issues with previous versions (such as ``apptainer version 1.1.3-1.el7``). Please
ensure that you are using the latest version.
- ``Docker``:
The latest versions (``25.x``) cannot be used as they are not compatible yet with apptainer/ singularity.
We are waiting for an update from the apptainer team. To track this issue, please check the `forum post`_.
Configuring the cluster parameters Configuring the cluster parameters
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
...@@ -157,3 +164,4 @@ The above will, in addition, also render videos of the training progress and sto ...@@ -157,3 +164,4 @@ The above will, in addition, also render videos of the training progress and sto
.. _apptainer: https://apptainer.org/ .. _apptainer: https://apptainer.org/
.. _documentation: www.apptainer.org/docs/admin/main/installation.html#install-ubuntu-packages .. _documentation: www.apptainer.org/docs/admin/main/installation.html#install-ubuntu-packages
.. _SLURM documentation: www.slurm.schedmd.com/sbatch.html .. _SLURM documentation: www.slurm.schedmd.com/sbatch.html
.. _forum post: https://forums.docker.com/t/trouble-after-upgrade-to-docker-ce-25-0-1-on-debian-12/139613
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment