Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

%files section executed before %post ? #170

Open
jbd opened this issue Feb 14, 2018 · 2 comments
Open

%files section executed before %post ? #170

jbd opened this issue Feb 14, 2018 · 2 comments

Comments

@jbd
Copy link
Contributor

jbd commented Feb 14, 2018

Hello,

the documentation (http://singularity.lbl.gov/docs-recipes#files) says:

Files are copied after any %post or installation procedures, so if you need the copied files or directories to exist during %post you must do this via %setup. Let’s add the avocado.txt into the container, to join tacos.txt.

With that in mind, I was thinking that this recipe would have work:

$ touch avocados.txt
$ cat test.singularity
Bootstrap: docker
From: ubuntu

%post
    mkdir -p /test/input

%files
avocados.txt /test/input
$ sudo singularity build test.simg test.singularity 
Using container recipe deffile: test.singularity
Sanitizing environment
Adding base Singularity environment to container
Docker image path: index.docker.io/library/ubuntu:latest
Cache folder set to /root/.singularity/docker
Exploding layer: sha256:1be7f2b886e89a58e59c4e685fcc5905a26ddef3201f290b96f1eff7d778e122.tar.gz
Exploding layer: sha256:6fbc4a21b806838b63b774b338c6ad19d696a9e655f50b4e358cc4006c3baa79.tar.gz
Exploding layer: sha256:c71a6f8e13782fed125f2247931c3eb20cc0e6428a5d79edb546f1f1405f0e49.tar.gz
Exploding layer: sha256:4be3072e5a37392e32f632bb234c0b461ff5675ab7e362afad6359fbd36884af.tar.gz
Exploding layer: sha256:06c6d2f5970057aef3aef6da60f0fde280db1c077f0cd88ca33ec1a70a9c7b58.tar.gz
Exploding layer: sha256:c6a9ef4b9995d615851d7786fbc2fe72f72321bee1a87d66919b881a0336525a.tar.gz
Adding files to container
Copying 'avocados.txt' to '/test/input'
/bin/cp: cannot create regular file '/usr/local/var/singularity/mnt/container//test/input': No such file or directory
ERROR: Failed copying file(s) into container
Running post scriptlet
+ mkdir -p /test/input
Finalizing Singularity container
Calculating final size for metadata...
Skipping checks
Building Singularity image...
Singularity container built: test.simg
Cleaning up...

Apparently, the files section is executed before the post section:

/bin/cp: cannot create regular file '/usr/local/var/singularity/mnt/container//test/input': No such file or directory

This recipe is working:

$ cat test2.singularity
Bootstrap: docker
From: ubuntu

%setup
    mkdir -p ${SINGULARITY_ROOTFS}/test/input

%files
avocados.txt /test/input

Maybe I misunderstood something ?

@vsoch
Copy link
Member

vsoch commented Feb 14, 2018

I think this is a bug - we used to have files copied after, and now it's before.

@vsoch
Copy link
Member

vsoch commented Feb 14, 2018

hey @jbd I just edited the page - take a look and let me know if everything looks ok.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants