I have a simple Dockerfile
we use solely while developing a React component library that uses Storybook
. The configuration simply pulls from node:latest
and mounts our project.
Dockerfile
FROM node:latest
EXPOSE 6006
WORKDIR /usr/src/app
COPY . .
RUN npm install
CMD [ "bash" ]
Building and Running
docker build -t <our name> .
docker run --rm -it -p 6006:6006 -v $(pwd):/usr/src/app <our name>
# Inside interactive container
npm run storybook
package.json
{
"scripts": {
"storybook": "start-storybook -p 6006"
}
}
At work, we use Ubuntu and this setup worked as expected.
However while using:
it seems that no changes to story files are observed. File saves do not trigger any activity in the console, nor in the browser.
Why could this be the case? Is there a problem with our Docker setup that we're missing?
This actually stems from a known problem #56.
Inotify does not work on Docker for Windows
The Docker For Windows Documentation recommends using a poling solution:
Currently, inotify does not work on Docker Desktop for Windows. This becomes evident, for example, when an application needs to read/write to a container across a mounted drive. Instead of relying on filesystem inotify, we recommend using polling features for your framework or programming language.
One poling solution is docker-windows-volume-watcher
.
Running the below from another terminal in the project directory solves the issue:
docker-volume-watcher <name of running container> $(pwd)