Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docker mount problem on MAC #328

Open
michael-kotliar opened this issue Mar 9, 2017 · 5 comments · Fixed by #670
Open

Docker mount problem on MAC #328

michael-kotliar opened this issue Mar 9, 2017 · 5 comments · Fixed by #670
Assignees
Labels

Comments

@michael-kotliar
Copy link
Contributor

Output from a step is saved to a folder which by default is not allowed to be mounted by Docker.
The folder is /var/folders. Default configuration includes: /Users, /Volumes, /private, /tmp. If add it manually in Docker preferences all works fine.

To run the test:
cwl-runner --debug workflow.cwl job.yml
Link to testing example:
https://github.com/michael-kotliar/cwl_sandbox/tree/master/mac_docker_fail

Part from the log:

[job copy_2] /var/folders/sd/41rg42_16q72_2yzl_vvgsbw0000gn/T/tmpuEpjSV$ docker \
    run \
    -i \
    --volume=/var/folders/sd/41rg42_16q72_2yzl_vvgsbw0000gn/T/tmptNfjZl/./empty_copy.txt:/private/var/lib/cwl/stgcce3847f-a49b-4279-b1b1-0d5366ac8b4e/empty_copy.txt:ro \
    --volume=/private/var/folders/sd/41rg42_16q72_2yzl_vvgsbw0000gn/T/tmpuEpjSV:/private/var/spool/cwl:rw \
    --volume=/private/var/folders/sd/41rg42_16q72_2yzl_vvgsbw0000gn/T/tmpxbsJsT:/tmp:rw \
    --workdir=/private/var/spool/cwl \
    --read-only=true \
    --user=501 \
    --rm \
    --env=TMPDIR=/tmp \
    --env=HOME=/private/var/spool/cwl \
    ubuntu \
    cp \
    /private/var/lib/cwl/stgcce3847f-a49b-4279-b1b1-0d5366ac8b4e/empty_copy.txt \
    empty_copy_copy.txt
docker: Error response from daemon: Mounts denied: cker-for-mac/osxfs/#namespaces for more info.
.
l_vvgsbw0000gn/T/tmptNfjZl/./empty_copy.txt
is not shared from OS X and is not known to Docker.
You can configure shared paths from Docker -> Preferences... -> File Sharing.
See https://docs.docker.com/do.
ERRO[0000] error getting events from daemon: net/http: request canceled 

Docker version:

Client:
 Version:      17.03.0-ce
 API version:  1.26
 Go version:   go1.7.5
 Git commit:   60ccb22
 Built:        Thu Feb 23 10:40:59 2017
 OS/Arch:      darwin/amd64

Server:
 Version:      17.03.0-ce
 API version:  1.26 (minimum version 1.12)
 Go version:   go1.7.5
 Git commit:   3a232c8
 Built:        Tue Feb 28 07:52:04 2017
 OS/Arch:      linux/amd64
 Experimental: true

cwl-runner version: 1.0.20170224141733

@denis-yuen
Copy link
Member

This sounds similar to something we encountered.
There's a possible workaround at the bottom of https://dockstore.org/docs/faq

Docker behaves a bit differently on a mac than on a typical ubuntu machine. By default the only shared > volumes are /Users, /Volumes, /tmp, and /private. Note that /var is not a shared directory (and can’t be > set as one). CWLtool uses your TMPDIR (the env variable) to setup volumes with docker, which on a Mac can default to a subdirectory of /var. In order to get CWLtool working on your mac, you need to set your TMPDIR to be under one of the shared volumes in Docker for Mac. You can do this by doing something similar to the following:

export TMPDIR=/tmp/docker_tmp

@tetron
Copy link
Member

tetron commented Mar 9, 2017

I'll accept a patch which tweaks the defaults for --tmpdir-prefix and --tmp-outdir-prefix on OS X.

qiukunlong pushed a commit to qiukunlong/cwltool that referenced this issue Mar 25, 2017
aa320ec Merge pull request common-workflow-language#342 from common-workflow-language/fix-mystery-package-errors
3c6eaff Update for rename of argparse2cwl to argparse2tool
b14404b remove errant jsonldPredicate
7f116da Merge pull request common-workflow-language#339 from common-workflow-language/dockerOutputDirectory
4f65d1f Add test for dockerOutputDirectory option of DockerRequirement.
cb1f928 Merge pull request common-workflow-language#335 from common-workflow-language/output-literals
d8b6c8f Add tests for file and directory literals in output as produced by expression tool.
ee3bb1c Merge pull request common-workflow-language#324 from common-workflow-language/secondaryfiles-array
5e6c2d4 Add NLeSC's Xenon
cbe1c8d Merge pull request common-workflow-language#334 from StarvingMarvin/master
8300e43 output ids must start with '#' in draft-2
f87d218 draft-3 test fixes: explicit output for args
8b10319 Fixes for draft-2 tests: adding explicit args output
83ed4b4 Merge remote-tracking branch 'rabix-cwl/master'
e0a5e7c Merge pull request common-workflow-language#328 from StarvingMarvin/master
d906c4a dir4 test fix
21bdcaf Merge remote-tracking branch 'upstream/master'
dee0f4e Disabled checksum check for listing input dir
fc4cb0f Added args output and empty.json for null jobs
a4950f4 Update tools list
8e1d67c Add Rabix Bunny CI badge
2a5b95e fixing mentions to draft3/4
1356c45 Add test for secondaryFiles with arrays
b60125b Single instead of double quotes in doc
179835b Merge pull request common-workflow-language#319 from common-workflow-language/test-cwl-out2
ed40737 Add additional test for cwl.output.json behavior.
a217bb6 Merge pull request common-workflow-language#317 from StarvingMarvin/master
8dd69f2 fixing test in v1.0 and v1.1.0-dev1
e831c20 Merge pull request common-workflow-language#314 from common-workflow-language/test-requirements-on-steps
8cad6f1 Add test for requirements/hints on workflow steps.
7679adb Merge pull request common-workflow-language#308 from common-workflow-language/embedded-subworkflow-test
1582677 Tighten up formatting
779c2d4 Add test for embedded subworkflow
e22a9c2 Merge pull request common-workflow-language#307 from alaindomissy/patch-3
125cb5f Update UserGuide.yml
99f4f9f Merge pull request common-workflow-language#303 from common-workflow-language/include-stdin-in-docs
5324dbb put stdin shortcut in correct place

git-subtree-dir: cwltool/schemas
git-subtree-split: aa320ec
@michael-kotliar
Copy link
Contributor Author

@tetron What patch should fix this issue? I've checked this bug again with the latest cwltool and have the same results. Or that patch has not been accepted yet?

tetron pushed a commit that referenced this issue Jul 23, 2017
@jrandall
Copy link
Member

jrandall commented Aug 14, 2017

Those patches seem to have references this issue by mistake - it doesn't look like the default behaviour of cwl-runner has been changed to address this issue.

However, setting TMPDIR to something that is available to the docker VM (as @denis-yuen suggests above) should fix the problem, and has the added benefit that it may fix the problem for other tools that use docker as well.

If you want to use your actual OS X provided user-specific temporary directory rather than the global /tmp/, you might add the following to your .bashrcto prepend the/privateprefix (which is available to docker) to the existing tmpdir that begins with/var` (which is not available to docker but they refer to the same actual directory by way of a symlink):

export TMPDIR="/private${TMPDIR}"

@wltrimbl
Copy link

I'm getting this error for certain data sources on OSX.

Expected Behavior

Toy workflow to download a file using http and display it using a docker image.

Actual Behavior

Fails with osx-specific error, related to Issue #328 and #812;

The path /var/folders/2g/k5ylcjt57_d4bqw352_flw740000gn/T/tmpaeCr3G is not shared from OS X and is not known to Docker.

input file is downloaded and staged in

/var/folders/2g/k5ylcjt57_d4bqw352_flw740000gn/T/tmpaeCr3G

but docker needs this to be prepended with /private on some OSX systems.

The remedy in Issue #328

export TMPDIR="/private${TMPDIR}" 

makes the workflow complete, and it works on ubuntu.

Workflow Code

cat > cat.cwl <<"EOF"
#!/usr/bin/env cwl-runner --debug
cwlVersion: cwl:v1.0
class: CommandLineTool
baseCommand: cat
hints:
  - class: DockerRequirement
    dockerPull: ubuntu:16.04
inputs:
  - id: input_file
    type: File
    inputBinding:
      position: 1
      valueFrom: $(inputs.input_file)
outputs: []
EOF

cat > cat-job.yml <<"EOF"
cwlVersion: cwl:v1.0
input_file:
  class: File
  location: "https://raw.githubusercontent.com/common-workflow-language/cwltool/master/README.rst"
  basename: README.Rst
EOF

Output

cwl-runner cat.cwl cat-job.yml

/Users/username/anaconda3/envs/python2/bin/cwl-runner 1.0.20180822145714
Resolved 'cat.cwl' to 'file:///Users/username/ks/cat.cwl'
[job cat.cwl] /private/tmp/docker_tmpZhORn3$ docker \
    run \
    -i \
    --volume=/private/tmp/docker_tmpZhORn3:/var/spool/cwl:rw \
    --volume=/private/var/folders/2g/k5ylcjt57_d4bqw352_flw740000gn/T/tmp2wE_eI:/tmp:rw \
    --volume=/var/folders/2g/k5ylcjt57_d4bqw352_flw740000gn/T/tmpaeCr3G:/var/lib/cwl/stg5c087dc6-b021-4e62-8adb-9198787d0626/README.Rst:ro \
    --workdir=/var/spool/cwl \
    --read-only=true \
    --user=501:20 \
    --rm \
    --env=TMPDIR=/tmp \
    --env=HOME=/var/spool/cwl \
    ubuntu:16.04 \
    cat
docker: Error response from daemon: Mounts denied: 
The path /var/folders/2g/k5ylcjt57_d4bqw352_flw740000gn/T/tmpaeCr3G
is not shared from OS X and is not known to Docker.
You can configure shared paths from Docker -> Preferences... -> File Sharing.
See https://docs.docker.com/docker-for-mac/osxfs/#namespaces for more info.
.
time="2018-08-24T09:38:20-05:00" level=error msg="error waiting for container: context canceled"
[job cat.cwl] completed permanentFail
Final process status is permanentFail
```

## Your Environment
* cwltool version: 
cwltool 1.0.20180822145714
OSX 10.13.6

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
7 participants