Hey Luca,
Ah yes, I know docker2singularity well because I
wrote most of the runtime script, that somehow was scraped of any credit via improper use of version control, lol. When you export the docker environment using that script,it writes directly to a file /environment, which mirrors how the very first singularity images were set up. Later images (made with singularity proper) store the docker environment variables in the image's metadata "env" folder, available via shell or exec with a simple source:
for script in /.singularity.d/env/*.sh; do
if [ -f "$script" ]; thenHere is where
. "$script"
fi
done
so you don't have the environment variables because they aren't being sourced. The option with -e would clean the environment from your host, not what is in the container.
Here is where some of this happens, if it helps.
I think if you want this to work as expected, you should put your docker image on docker hub, and then bootstrap appropriately:
singularity create image.img
sudo singularity bootstrap image.img Singularity
This will handle the Docker environment to coincide with the current implementation that sources it. Give that a go and see if it helps.
Best,
Vanessa