singularityhub/docker2singularity

-m flag can't handle multiple directories

paciorek opened this issue · 1 comments

I'm using Docker version 17.12.1-ce, build 7390fc6 on an Ubuntu 18.04 system. When I try to use -m with multiple directories, docker2singularity doesn't deal with the space in the -m string correctly. Note that it creates a directory "foo ".

It looks like the the "adding mount points" part of docker2singularity.sh changed at some point.

paciorek@shelob:~/staff/projects/docker-test/mpi> docker run -v /var/run/docker.sock:/var/run/docker.sock -v /tmp:/output --privileged -t --rm    singularityware/docker2singularity -m "/foo /bar" ubuntu:18.04
Image Format: squashfs
Docker Image: ubuntu:18.04

Inspected Size: 85 MB

(1/10) Creating a build sandbox...
(2/10) Exporting filesystem...
(3/10) Creating labels...
(4/10) Adding run script...
(5/10) Setting ENV variables...
(6/10) Adding mount points...
(7/10) Fixing permissions...
(8/10) Stopping and removing the container...
(9/10) Building squashfs container...
Building image from sandbox: /tmp/ubuntu_18.04-2018-09-05-5ecea5d81788.build
Building Singularity image...
Singularity container built: /tmp/ubuntu_18.04-2018-09-05-5ecea5d81788.simg
Cleaning up...
(10/10) Moving the image to the output folder...
     27,947,039 100%  369.74MB/s    0:00:00 (xfr#1, to-chk=0/1)
Final Size: 27MB
paciorek@shelob:~/staff/projects/docker-test/mpi> singularity shell /tmp/ubuntu_18.04-2018-09-05-5ecea5d81788.simg
Singularity: Invoking an interactive shell within container...

Singularity ubuntu_18.04-2018-09-05-5ecea5d81788.simg:~/staff/projects/docker-test/mpi> ls /
 accounts   boot   environment	'foo '	 lib	 media	 opt    root   sbin	     singularity.json   sys   usr
 bin	    dev    etc		 home	 lib64	 mnt	 proc   run    singularity   srv	        tmp   var

If I simply start a Docker container using the docker2singularity image, and try to run the mkdir -p line from docker2singularity.sh, I essentially recreate the issue; 'foo bar' is a single directory here:

paciorek@shelob:~/staff/projects/docker-test/mpi> docker run -it --rm --entrypoint "/bin/bash" singularityware/docker2singularity
bash-4.3# mount_points="foo bar"
bash-4.3# new_container_name=/tmp/blah.id
bash-4.3# build_sandbox="${new_container_name}.build"
bash-4.3# echo ${build_sandbox}
/tmp/blah.id.build
bash-4.3# mkdir -p "${build_sandbox}/${mount_points}"
bash-4.3# ls /tmp/blah.id.build/
foo bar
vsoch commented

hey @paciorek I think this issue has been fixed across all branches / versions, so I'm going to close the issue. Please reopen if you have any other issues!