Singularity: How to copy environment variables from base images to daughter images?

Created on 10 Dec 2018  路  4Comments  路  Source: hpcng/singularity

Version of Singularity:

singularity version 3.0.1-145.gc9822fe

Expected behavior

base.def

Bootstrap: docker
From: ubuntu:latest

%label
AUTHOR Alex

%environment
PATH=/mnt:$PATH
export PATH

singularity exec base.sif cat /.singularity.d/env/90-environment.sh

!/bin/sh

PATH=/mnt:$PATH
export PATH

test.def

Bootstrap: localimage
From: base.sif

%label
AUTHOR Alex

%environment
PATH=/opt:$PATH
export PATH
sigularity shell test.sif

echo $PATH
/opt:/mnt:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:

Actual behavior

sigularity shell test.sif

echo $PATH
/opt:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:

No found /mnt from base.sif in $PATH of test.sif

in version 2. *, the environment variables are inherited without problem.

All 4 comments

Nice to see you @al3x609! Looks like a bug. ping @ikaneshiro !

@al3x609 @GodloveD I agree, the environment should be inherited

many thanks, @ikaneshiro @GodloveD , it works fine. 馃憤

Closing. Thanks for the report @al3x609 !

Was this page helpful?
0 / 5 - 0 ratings