Docker bound mount - can not see changes on browser

前端 未结 1 1153
被撕碎了的回忆
被撕碎了的回忆 2021-01-21 18:05

I\'m using docker-toolbox on windows home. I was able to run a jekyll-serve web server image to see the default page on browser, but when I try to edit file on VS Code, I can no

相关标签:
1条回答
  • 2021-01-21 18:36

    Issue identified

    Bind mounting actually does not work for docker toolbox:

    file change events in mounted folders of host are not propagated to container by Docker for Windows

    Solution

    This script is intended to be the answer to this issue: docker-windows-volume-watcher.


    Side note

    This is a common issue with data manipulated outside of your container.

    For jekyll, in particular, even the solution described in the issue below does not work for windows-based systems.

    https://github.com/jekyll/jekyll-watch/issues/17

    In short you need to execute jekyll with the --force_polling flag (Does not work with Windows Hosts). You can find it in the jekyll docs here

    https://jekyllrb.com/docs/configuration/options/


    On Linux based systems it works out of the box since the image used in the question bretfisher/jekyll-serve already utilizes the --force_polling flag.

    just ran

    docker run --rm -it -e JEKYLL_NEW=true -p 8080:4000 -v (pwd):/site bretfisher/jekyll new . 
    

    to create a new jekyll site and

    docker run --rm -it -e JEKYLL_NEW=true -p 8080:4000 -v (pwd):/site bretfisher/jekyll-serve                                                  
    

    to run it mounted to a directory on my machine (linux) and was able to edit a file with changes propagating to jekyll.

    0 讨论(0)
提交回复
热议问题