Unable to import a docker container image tar file to a singularity container

791 views
Skip to first unread message

Sadanand Warrier

unread,
Jan 19, 2017, 11:14:53 AM1/19/17
to singularity
Hello, I had asked this question on a previous thread a couple of days ago and got no response, so I thought I would create a new post. Here is what the issue is

Hello

So I went through the answers but there is something that is a little puzzling. I'm trying to convert a docker image to a Singularity container image. So I followed the process that the "singularity --help import" suggests by creating a tar file from the image using 
"docker save -o <tarfilename> <image file>

 and then  trying to convert it by using

sudo singularity import <singularityshell.img> <tarfilename>.

Tried various things including increasing the singularityshell.img size from default 768M to 2048M (the docker container is 732M in size)  but always got this error

Bootstrap initialization
No bootstrap definition passed, updating container
Executing Prebootstrap module
Executing Postbootstrap module
ERROR: Container does not contain the valid minimum requirement of /bin/sh

There was actually a /bin/sh in the docker container so I think this is some generic error.

I finally managed to do the conversion by running the image interactively and then doing this

docker export <containername> | sudo singularity import <singularityshell.img>

Am I doing something wrong while importing the tar file?

I did not try creating a local registry and pushing the image to it etc.

My question is why doesn't the tar method work??

Thanks

S

Lito Bejarano

unread,
Jan 19, 2017, 11:19:31 AM1/19/17
to singu...@lbl.gov
Hi Sananad,

as of 2.2 version, it will be easier trying to create a Singularity definition file with the docker bootstrap method.

As you can see in https://github.com/singularityware/singularity/blob/master/examples/docker.def you can select the docker image to pull from the registry and build your Singularity container based on that docker image.

Regards,

--
You received this message because you are subscribed to the Google Groups "singularity" group.
To unsubscribe from this group and stop receiving emails from it, send an email to singularity+unsubscribe@lbl.gov.

Sadanand Warrier

unread,
Jan 19, 2017, 12:51:33 PM1/19/17
to singularity
Hi Lito
   Thanks for the reply. The reason I did not dabble with the bootstrap method was because I had a docker container on which some specific software had been installed.and I did that by creating a basic container and then installing this software on it and then creating a new image which had the installed software.  I didn't want to go through that process, initially, with Singularity. I needed to quickly demo some stuff to show SIngularity's strengths. Hence the question.

S
To unsubscribe from this group and stop receiving emails from it, send an email to singularity...@lbl.gov.

Gregory M. Kurtzer

unread,
Jan 19, 2017, 1:00:16 PM1/19/17
to singularity
Hi Sananad,

I'm not sure why the docker save method didn't work, but the docker export | singularity import method is what I typically use for this. Can someone else more familiar with Docker then I replicate this error? It sounds like it also may need a bug report submitted.

Vanessa's also been working on the Docker API interaction, and I think pulling from the local Docker daemon's API was something she was playing with which I think would render the save model obsolete (but I'll let her confirm or deny that).

You can also try with debugging enabled (-d -x) and see if that points at the cause.

Greg


To unsubscribe from this group and stop receiving emails from it, send an email to singularity+unsubscribe@lbl.gov.


vanessa s

unread,
Jan 19, 2017, 1:11:50 PM1/19/17
to singu...@lbl.gov
Using the local method requires running a local registry, which (imho) is more annoying than just creating a bootstrap file, but it does work! I wrote up instructions here:


Can you provide the specific commands, and perhaps some way of sharing your Docker image, so we can better help debug?
--
Vanessa Villamia Sochat
Stanford University '16

Sadanand Warrier

unread,
Jan 19, 2017, 2:37:51 PM1/19/17
to singularity
Thanks Greg 
Vanessa , I had seen the link you put up but by then I had already created a Singularity image container from the docker image using the docker export command.
I cannot provide the docker image that I built it has some stuff that is not public domain.

The failure took place when I was doing this...

First create a tar file.

"docker save -o <tarfilename> <docker image file>  


 and then  try to convert it by using

sudo singularity import <singualrityshell.img> <tarfilename>.

It failed saying there was no /bin/sh , which wasn't true but I guess that is just a stock error.

I will run this with the debug commands that Greg suggested and will get back.

S
To unsubscribe from this group and stop receiving emails from it, send an email to singularity...@lbl.gov.

Sadanand Warrier

unread,
Jan 24, 2017, 2:39:44 PM1/24/17
to singularity
Hello Vanessa, Greg
    I got back to running the import command that fails reading from a tar file as Greg had suggested and will upload the output as a text file. The only salient thing I saw were these lines in the debug output. 

+ printf 'Executing Postbootstrap module\n'
Executing Postbootstrap module
+ return 0
+ eval /usr/local/libexec/singularity/bootstrap/modules-v2/postbootstrap.sh
++ /usr/local/libexec/singularity/bootstrap/modules-v2/postbootstrap.sh
+ '[' -z /var/lib/singularity/mnt/final ']'
+ '[' '!' -L /var/lib/singularity/mnt/final/bin/sh -a '!' -x /var/lib/singularity/mnt/final/bin/sh ']'
+ message ERROR 'Container does not contain the valid minimum requirement of /bin/sh\n'
+ LEVEL=ERROR
+ MESSAGE='Container does not contain the valid minimum requirement of /bin/sh\n'
+ '[' -z 'Container does not contain the valid minimum requirement of /bin/sh\n' ']'
+ shift
+ shift
+ case "$LEVEL" in
+ tput -Txterm setaf 1
+ printf 'ERROR: Container does not contain the valid minimum requirement of /bin/sh\n'
ERROR: Container does not contain the valid minimum requirement of /bin/sh

I must add that I can import this same docker container by starting it and then exporting the running container to a singularity import command. There is no problem doing that and the new singularity container created functions very well.
singularitymessages.txt
Reply all
Reply to author
Forward
0 new messages