Repository navigation
Description
I'm trying to build some simple tools that have Docker requirements. I use boot2docker on Mac OS X 10.10.4, and jobs fail because the user inside the container cannot write to the output directory.
This is related to a quirk of boot2docker/VirtualBox folder sharing on Mac OS X. In order to make Mac OS X host directories available as volumes in Docker, boot2docker uses VirtualBox Shared Folders on Mac OS X. The /Users directory is shared into the boot2docker VM, and owned by an arbitrary UID:GID (1000:50) inside the boot2docker VM.
I appreciate that cwl-runner tries to prevent root-owned files by using my native UID (501) as the UID inside the container. But this seems to be incompatible with boot2docker shared folders, since the directory in the boot2docker is owned by UID 1000 and UID 501 cannot write to it.
Ironically, letting container processes run as root typically works better on boot2docker/VirtualBox (not that I'd recommend it as a solution), because the container can still write to any directory in the boot2docker VM, and VirtualBox restores ownership back to the host user (501 in my case).
$ id -u
501
$ ls -ldn /Users/dcl9/
drwxr-xr-x+ 98 501 20 3332 Jul 21 11:34 /Users/dcl9/
$ docker run -v /Users/dcl9:/Users/dcl9 ubuntu ls -ldn /Users/dcl9
drwxr-xr-x 1 1000 50 3332 Jul 21 15:34 /Users/dcl9
Samples: gist
$ cwl-runner copy.cwl copy.json
/Users/dcl9/Code/envs/cwl/bin/cwl-runner 1.0.20150715173345
[job 4461496720] exec docker run -i --volume=/Users/dcl9/Code/python/cwl-copy/sourcefile:/tmp/job809623956_cwl-copy/sourcefile:ro --volume=/Users/dcl9/Code/python/cwl-copy:/tmp/job_output:rw --volume=/var/folders/7t/q8bb2np92p5b26pk_h5lr0lh0000gn/T/tmpoTa6Hp:/tmp/job_tmp:rw --workdir=/tmp/job_output --user=501 --rm --env=TMPDIR=/tmp/job_tmp ubuntu:latest cp /tmp/job809623956_cwl-copy/sourcefile mycopy
cp: cannot create regular file 'mycopy': Permission denied
Exception while running job
Traceback (most recent call last):
File "build/bdist.macosx-10.10-intel/egg/cwltool/job.py", line 157, in run
outputs = self.collect_outputs(self.outdir)
File "build/bdist.macosx-10.10-intel/egg/cwltool/draft2tool.py", line 401, in collect_output_ports
ret[fragment] = self.collect_output(port, builder, outdir)
File "build/bdist.macosx-10.10-intel/egg/cwltool/draft2tool.py", line 437, in collect_output
raise WorkflowException("No matches for output file with glob: {}.".format(binding["glob"]))
WorkflowException: No matches for output file with glob: {'engine': 'cwl:JsonPointer', 'script': 'job/dest'}.
[job 4461496720] completed permanentFail
Final process status is permanentFail
{}
Running the same with the requirements removed works as expected:
$ cwl-runner copy.cwl copy.json
/Users/dcl9/Code/envs/cwl/bin/cwl-runner 1.0.20150715173345
[job 4366240144] exec cp /Users/dcl9/Code/python/cwl-copy/sourcefile mycopy
Final process status is success
{
"output": {
"path": "/Users/dcl9/Code/python/cwl-copy/mycopy",
"size": 13,
"class": "File",
"checksum": "sha1$cd50d19784897085a8d0e3e413f8612b097c03f1"
}
}
Activity
dleehr commentedon Jul 21, 2015
boot2docker's automount-shares - uses uid/gid of
dockeruserdleehr commentedon Jul 21, 2015
Tried Use with boot2docker, but this did not help, as my files were already under
/Users:Use UID of docker user in boot2docker/docker-machine if running
Add map and typedsl resolution documentation. (#96)
Squashed 'v1.1.0-dev1/salad/' changes from 98a5bea..27c20e8