Skip to content
This repository was archived by the owner on Jul 25, 2024. It is now read-only.
This repository was archived by the owner on Jul 25, 2024. It is now read-only.

Host and container filesystems out of sync #6

@ijosc

Description

@ijosc

Thanks so much for sharing your work! I gave this a try, but after I initially was super happy how well it worked I realised an issue related to watching files that are mounted from the host. I am unsure whether I am simply not using the right mount options or whether what I am trying to do will not work. Our use case is to mount a source directory with -v on docker run, and having a webpack-dev-server running in the container. Whenever a file is changed in the source directory, the dev server should recompile, which it doesn't.

To reproduce (without webpack-dev-server, just using inotifywait):

test.txt

test text

test.sh

#!/bin/sh
while inotifywait test.txt; do
  echo "file changed"
done

Dockerfile

FROM ubuntu:18.04

RUN apt-get update -qq && apt-get install -qq -y --no-install-recommends \
    inotify-tools

WORKDIR /home

CMD chmod +x test.sh && ./test.sh
  • build docker image docker build -t mobytest .
  • run docker container with pwd mounted docker run -it --rm -v $(pwd):/home mobytest:latest --> watches should be established, leave open
  • test from host: echo "host waz here" > test.txt --> no file change detected, cat test.txt in container shows change has in fact been made
  • test from within container: echo "docker waz here" > test.txt --> file change detected

What I have tried

  • docker-machine-nfs ${VMNAME} --mount-opts="noacl,async,noatime,actimeo=1,nfsvers=3" (same as from install.sh)
  • docker-machine-nfs ${VMNAME} --mount-opts="noacl,async,nolock,vers=3,udp,noatime,actimeo=2"(from this article)
  • removing async option
  • setting sync option
  • setting shared folder to actual source directory

any help would be greatly appreciated :)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions