Zenika-Training / zenika-formation-framework

Tools to build and present our training material
8 stars 25 forks source link

volume mount pb when using docker for win #224

Closed looztra closed 6 years ago

looztra commented 6 years ago
$ docker run --rm -v //d/tmp/Formation--Modele-cfk/Gruntfile.js:/data/Gruntfile.js -v //d/tmp/Formation--Modele-cfk/Slides/:/data/Slides/ -v //d/tmp/Formation--Modele-cfk/package.json:/data/package.json -v //d/tmp/Formation--Modele-cfk/CahierExercices:/data/CahierExercices -v //d/tmp/Formation--Modele-cfk/PDF:/data/PDF zenika/formation-framework:v3 grunt pdf
Loading "Gruntfile.js" tasks...ERROR
>> Error: Cannot find module '/data/Gruntfile.js'
Warning: Task "pdf" not found. Use --force to continue.

Aborted due to warnings.

When I go inside the container thx to a bash shell:

$ winpty docker run -ti --rm -v //d/tmp/Formation--Modele-cfk/Gruntfile.js:/data/Gruntfile.js -v //d/tmp/Formation--Modele-cfk/Slides/:/data/Slides/ -v //d/tmp/Formation--Modele-cfk/package.json:/data/package.json -v //d/tmp/Formation--Modele-cfk/CahierExercices:/data/CahierExercices -v //d/tmp/Formation--Modele-cfk/PDF:/data/PDF zenika/formation-framework:v3 bash
root@e25e312e9215:/data# ls
CahierExercices  Gruntfile.js  PDF  Slides  node_modules  package-lock.json  package.json
root@e25e312e9215:/data# more Gruntfile.js/

*** Gruntfile.js/: directory ***

root@e25e312e9215:/data# ls -l
total 16
drwxr-xr-x 2 root root   40 Jan  6 15:57 CahierExercices
drwxr-xr-x 2 root root   40 Jan  6 15:57 Gruntfile.js
drwxr-xr-x 2 root root   40 Jan  6 15:57 PDF
drwxr-xr-x 2 root root   40 Jan  6 15:57 Slides
drwxr-xr-x 1 root root 4096 Dec  5 09:27 node_modules
-rw-r--r-- 1 root root 9730 Dec  5 09:24 package-lock.json
drwxr-xr-x 2 root root   40 Jan  6 15:57 package.json
root@e25e312e9215:/data# cd Gruntfile.js/
root@e25e312e9215:/data/Gruntfile.js# ls

looks like mounting files as volumes under docker for windows does not work (anymore?) because /data/Gruntfile.js is a directory and not a file like expected

hgwood commented 6 years ago

Your volume option might not be correct because of path transformations applied by msys (which is part of git bash). Could you try removing the leading slash from the host path and prepending the whole command by MSYS_NO_PATHCONV=1?

If that still gives a folder then it must be some kind of docker for windows bug, right?

looztra commented 6 years ago

works fine like this:

christopher@looz8 MINGW64 ~/workspace/Formation--Modele-cfk (docker_win10_exp)
$ MSYS_NO_PATHCONV=1 docker run --rm -v /c/Users/christopher/workspace/Formation--Modele-cfk/Gruntfile.js:/data/Gruntfile.js -v /c/Users/christopher/workspace/Formation--Modele-cfk/Slides/:/data/Slides/ -v /c/Users/christopher/workspace/Formation--Modele-cfk/package.json:/data/package.json -v /c/Users/christopher/workspace/Formation--Modele-cfk/CahierExercices:/data/CahierExercices -v /c/Users/christopher/workspace/Formation--Modele-cfk/PDF:/data/PDF zenika/formation-framework:v3 grunt pdf
Running "sed:title" (sed) task
/data/node_modules/zenika-formation-framework/index.html

Running "sed:version" (sed) task

Running "sed:dist" (sed) task
/data/node_modules/zenika-formation-framework/app.yaml

Running "sed:description" (sed) task
/data/node_modules/zenika-formation-framework/summary.html

Running "sed:slidesPdf" (sed) task
/data/node_modules/zenika-formation-framework/summary.html

Running "sed:cahierExercicesPdf" (sed) task
/data/node_modules/zenika-formation-framework/summary.html

Running "sed:github" (sed) task
/data/node_modules/zenika-formation-framework/summary.html

Running "sed:homepage" (sed) task
/data/node_modules/zenika-formation-framework/summary.html

Running "connect:print" (connect) task
Started connect web server on http://0.0.0.0:8000

Running "doGenerateSlidesPDF" task

Running "generateCahierExercice" task
Using CSS file /data/node_modules/zenika-formation-framework/styleCahierExercice.css
Using highlightPath file /data/node_modules/zenika-formation-framework/reveal/theme-zenika/code.css
Using md sources files [ '/data/CahierExercices/Cahier.md' ]