In AWS, created a docker image with a python script to print a string(basicprint.py
)
docker file:
FROM python
COPY ./basicprint.py ./
CMD ["python", "basicprint.py"]
It works fine then saved docker image as .tgz
file.
copy that .tgz
file in to my local.
I converted docker image(.tgz
) into singularity
image by using
singularity build sing_image.sif docker-archive://filename.tgz
it was successfully created sing_image.sif
singularity run sing_image.sif
It throws an error : basicprint.py: No such file or directory
Any suggestions on correct method of conversion without missing the file.
2
Answers
For testing, you could use a def file, using
%file
instead of the Dockerfile:In your case, create a
Singularity.def
file with:Check if that approach is working with:
Regarding your Dockerfile, try and use a different folder, again for testing:
Then:
Check also the
.sif
file includes your file:singularity exec sing_image.sif ls /app
.Note that you put your file under the very root.
singularity
removed your file during conversion and cleaning. Similar issues have been reported and are, in general, expected when working with containers.This slightly modified image
demonstrates that the file lands under the linux root:
Now, let me demonstrate the working version. Importantly, follow best Docker practices and use the working dir
where the sample Python script is
Then I build and test on
Debian GNU/Linux 10
withDocker 20.10.17
andSingularity 3.11
:Under the same software, I reproduced your error. So I think it has been solved! If you need any further assistance, we can set up a shared Virtual Machine with GitHub Codespace to make it fully reproducible.