singularity-2.2.1
on Scientific Linux 6
Something siimilar to :
>docker run hello-world
Hello from Docker!
This message shows that your installation appears to be working correctly.
> singularity run docker://hello-world
library/hello-world:latest
Downloading layer: sha256:a3ed95caeb02ffe68cdd9fd84406680ae93d633cb16422d00e8a7c22955b46d4
Downloading layer: sha256:5b0f327be733e58fbaea986eb671ed2eab9bc4a88bda1a7a284209e068d88dc9
ERROR: Container does not contain the valid minimum requirement of /bin/sh
ERROR : Container does not have a valid /bin/sh
ABORT : Retval = 255
Install singularity (yum install singularity in my case).
Run :
singularity run docker://hello-world
I can reproduce this on 2.3.2. I'm pretty sure it's the docker image... It doesn't appear to contain a /bin/sh at all, and instead only runs exec /hello
Singularity> file hello
hello: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), statically linked, BuildID[sha1]=1519e837125a7fae622e7207e7af8cc7711c76c3, stripped
I also "bootstrapped" the hello-world image (see above)... and this also fails:
SINGULARITY_SHELL=/hello singularity shell container.img
ERROR : No valid /bin/sh in container
ABORT : Retval = 255
Note: Even with SINGULARITY_SHELL set, it prints that it's looking for /bin/sh ... which it may, or may not, actually be doing. Or since the /.singularity.d/actions/ scripts require /bin/sh it's failing.
I've tried this too, and it doesn't work because the "hello world" isn't an actual, full image, it's just an executable file "hello" (see here) https://github.com/docker-library/hello-world/blob/7d0ee592e4ed60e2da9d59331e16ecdcadc1ed87/amd64/hello-world/Dockerfile. If you wanted to use it, you would probably need to create an image with an OS first, and then import hello world and call it.
Thank you for explications. Ok, I understand the problem.
And I think there is only few peoples that want to really use hello-world image. But probably it should be fixed or at least explained, because :
1) I saw a very little presentation about singularity yesterday;
2) I went back to my office, instaledl singularity and tried the very first image "hello-world"...
3) And... it did not work.
So the first impression of singularity is globally bad.
Finally...as I understand, docker image that starts with "FROM scratch" (= from nothing) risks not to work.
Is it correct? (of course it depends that we are doing after "FROM scratch" in our docker, but globally the risk is high).
we have a "getting started" page on our main site, what was your flow of actions so that you didn't find it? I definitely would want to improve the resources we offer so you aren't frustrated off the bat.
and correct: From scratch is not a valid bootstrap for singularity.
@paulz1
I was able to make it work as you're expecting doing the following (Singularity 2.3.2)
$ singularity create --size 700 container.img
$ sudo singularity bootstrap ~/container.img examples/busybox/Singularity
$ singularity import ~/container.img docker://hello-world
$ ~/container.img
Hello from Docker!
This message shows that your installation appears to be working correctly.
[ ... ]
So, as mentioned, since the hello-world Docker image is very... very... minimal. It fails since the helper scripts need /bin/sh to do anything.
examples/busybox/Singularity is the examples from the git repository.
It doesn't seem like the minimal viable requirement of a container, according to Singularity, is /bin/sh and this container does not include that. I don't think there is anything we can do here so closing the issue.
@jmstover I ran into the exact same issue while trying to get the docker hello-world to run from singularity and I am now trying your solution.
Question: where did you place the examples/busybox/Singularity folder before running the commands?
I am getting ERROR: Unknown container build definition format: examples/busybox/Singularity when I run:
$ sudo singularity bootstrap ~/container.img examples/busybox/Singularity
Thanks!
@gidili I just ran it from the top level of a git checkout.
All you need to do is have a base operating system to add the hello world onto. Here is an example.
mkdir box
sudo singularity build --sandbox box docker://ubuntu
sudo singularity build --sandbox box docker://hello-world
singularity run box
Hello from Docker!
This message shows that your installation appears to be working correctly.
To generate this message, Docker took the following steps:
1. The Docker client contacted the Docker daemon.
2. The Docker daemon pulled the "hello-world" image from the Docker Hub.
(amd64)
3. The Docker daemon created a new container from that image which runs the
executable that produces the output you are currently reading.
4. The Docker daemon streamed that output to the Docker client, which sent it
to your terminal.
To try something more ambitious, you can run an Ubuntu container with:
$ docker run -it ubuntu bash
Share images, automate workflows, and more with a free Docker ID:
https://cloud.docker.com/
For more examples and ideas, visit:
https://docs.docker.com/engine/userguide/
Most helpful comment
All you need to do is have a base operating system to add the hello world onto. Here is an example.