10-docker2singularity.sh PATH overrides 10-docker.sh
nathanweeks opened this issue · 15 comments
10-docker2singularity.sh currently contains:
#!/bin/sh
export PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
It's copied to /.singularity.d/env/10-docker2singularity.sh in the resulting singularity image.
However, since 10-docker2singularity.sh
sorts (ASCII) after 10-docker.sh
, any PATH set by a Dockerfile ENV directive (represented in 10-docker.sh) will be overwritten with the PATH set in 10-docker2singularity.sh.
Is 10-docker2singularity.sh still necessary (naive question)? If so, could it perhaps be renamed to, e.g., 9-docker2singularity.sh, so any PATH that is set in the source Docker image via Dockerfile ENV directive will still apply?
In that it's a singularity build with a sandbox, it's probably no longer necessary (but perhaps needed to be). Have you tried removing it and building a container?
Hi @vsoch , following your suggestion, I removed scripts/env/10-docker2singularity.sh, built a modified docker2singularity image, and used it to export Debian, CentOS, and Alpine Singularity images. In all cases their /.singularityenv.d/env/10-docker.sh set PATH to what it would have been set to when executing a corresponding Docker container via docker run -it --entrypoint=/bin/sh <IMAGE>
. So 10-docker2singularity.sh does seem unnecessary at this point?
It does indeed!
Since the branches each correspond to a different Singularity version (unfortunately many are different) to move forward, you'd want to choose the branch to edit, and PR to it. The master branch (should be) the latest version of the branches. It's a bit messy, but I'm not sure there is a better way to go about it.
OK, will do. Should the PR go to the 3.2.1 branch?
Yes! And after that, I'll PR 3.2.1 to master so it's up to date. Thank you!
Is the v3.2.1 branch supposed to work as-is? I get the following error:
$ git checkout v3.2.1
$ docker build -t docker2singularity-local:v3.2.1-orig .
...
$ docker run -v /var/run/docker.sock:/var/run/docker.sock -v /tmp/singularity:/output --privileged -t --rm docker2singularity-local:v3.2.1-orig alpine:3.10.1
docker: Error response from daemon: OCI runtime create failed: container_linux.go:344: starting container process caused "exec: \"docker-entrypoint.sh\": executable file not found in $PATH": unknown.
Sounds like the entrypoint file wasn't added?
I'll be able to test this in a few minutes, sorry doing a million things right now.
Can you try with singularityware/docker2singularity:v3.1
That one works:
$ git checkout v3.1
$ docker build -t docker2singularity-local:v3.1 .
...
$ docker run -v /var/run/docker.sock:/var/run/docker.sock -v /tmp/singularity:/output --privileged -t --rm docker2singularity-local:v3.1 alpine:3.10.1
...
INFO: Build complete: /tmp/alpine_3.10.1-2019-07-11-5def832712fb.simg
(10/10) Moving the image to the output folder...
2,752,512 100% 50.86MB/s 0:00:00 (xfr#1, to-chk=0/1)
Final Size: 3MB
Ah interesting, I think it's likely that I started working on that branch, but then didn't actually finish. The last released version is v3.1.
Let's do this - start with v3.1, and then pull request to v3.2.1.
Will do.