singularity icon indicating copy to clipboard operation
singularity copied to clipboard

%test section of bootstrap does not bring in the same things as shell/exec

Open mcuma opened this issue 8 years ago • 7 comments

Version of Singularity:

2.3.1

Expected behavior

It would be good to consider supporting things like environment, bind mounting and Nvidia stack (--nv) in the %test section of the bootstrap so that container testing could be included inside of the Singularity spec file.

Actual behavior

Environment variables defined in %environment don't work, bind mounting does not work, --nv does not work.

Steps to reproduce behavior

For example with the environment: %environment export FOO=bar %test echo $FOO

NOTE: The environment and bind mounting work if the %test section is executed separately after the container was built, e.g. when doing sudo singularity bootstrap my.img my.def followed by sudo singularity bootstrap -s test my.img my.def

But this requires the initial bootstrap to run again, and, still does not bring in the Nvidia stack.

My current workaround is to do the testing in a separate singularity exec command, but, it beats the purpose of having single spec file for the container deployment.

mcuma avatar Sep 08 '17 17:09 mcuma

Hi @mcuma!

If you want to bind mount a directory into your container during bootstrap you can actually already do it by leveraging the %setup section. Just write something like this:

%setup
    mount --no-mtab --rbind "/host/dir" "$SINGULARITY_ROOTFS/container/dir"

As for the --nv option working during bootstrap for test, I thinks it's a good idea. We've had requests in the past, but the users have always found workarounds.

GodloveD avatar Sep 08 '17 18:09 GodloveD

+1. I was about to reference this issue in the other about bootstrap :)

vsoch avatar Sep 08 '17 19:09 vsoch

Hello,

This is a templated response that is being sent out to all open issues. We are working hard on 'rebuilding' the Singularity community, and a major task on the agenda is finding out what issues are still outstanding.

Please consider the following:

  1. Is this issue a duplicate, or has it been fixed/implemented since being added?
  2. Is the issue still relevant to the current state of Singularity's functionality?
  3. Would you like to continue discussing this issue or feature request?

Thanks, Carter

carterpeel avatar May 15 '21 16:05 carterpeel

@carterpeel this needs to be evaluated if it’s still an issue, and if so it’s considered a bug and needs to be fixed.

vsoch avatar May 15 '21 16:05 vsoch

This issue has been automatically marked as stale because it has not had activity in over 60 days. It will be closed in 7 days if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Jul 14 '21 17:07 stale[bot]

Don't close stalebot, the contributors to this issue have responded and it's the maintainers that have not.

vsoch avatar Jul 14 '21 17:07 vsoch

@mcuma We're looking into the issue carefully, soon will bring to community and discuss ways to better solve as well address this. Thankyou for keeping the interest in the subject.

pedroalvesbatista avatar Jul 15 '21 00:07 pedroalvesbatista

Pending issues from the old repo copied to the new repo (https://github.com/apptainer/apptainer/issues/1390) and cleaned from the old, retired repo.

kmuriki avatar Jun 06 '23 02:06 kmuriki