npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

docker-windows-notifier

v1.1.0

Published

This program is watching your Windows Docker mounts for changes and notifies containers about that.

Downloads

12

Readme

Docker Windows Notifier

This program is watching your Windows Docker mounts for changes and notifies containers about that.

Because Docker mounts on Windows are just Samba shares and Samba shares protocol doesn't support notification about changes you normally would have to restart your container (or app in your container) to ie: rebuild the web app you're working on.

You can read more about this issue on Docker forums.

This fixes this issue when working on Windows.

Installation

Quick way

If you have node and npm installed you can install this program globally:

npm i -g docker-windows-notifier

Pros:

  • easy to set-up
  • globally available docker-windows-notifier command

Cons:

  • slower install
  • requires npm and node to be installed on Windows host
  • annoying Terminate batch job (Y/N)? on CTRL+C

Better way

Alternatively just download pre-build binaries from GitHub Releases.

You'll need to save this file to some directory that is in PATH environment variable of your system or modify PATH.

Pros:

  • faster to update, just save in proper place
  • doesn't require npm or node to be installed
  • no Terminate batch job (Y/N)? on CTRL+C

Cons:

  • requires manual PATH set-up or calling with full path

Usage

Let me just copy-paste docker-windows-notifier --help here:

  Usage: docker-windows-notifier [options]


  Options:

    -v, --version                                       output the version number
    -f, --file [path or `*` to use docker-compose.yml]  docker-compose files to be parsed (default: *)
    -s, --service [name,name,...]                       services from each docker-compose file of which volumes should be monitored, comma-separated (default: *)
    --debug                                             debug mode, more logging, more verbose errors
    -h, --help                                          output usage information


  Important:

    - Only version 3 of docker-compose files are supported
    - Start your Docker containers before running this program to avoid triggering a lot of notifications that are created during setup phase of your containers. I feel this may even crash your container start-up sometimes. Better safe than sorry
    - Run this when current working directory is the same as docker-compose file location
    - Commands are sent to containers via `container_name` specified in docker-compose service, so make sure to define names before using this program
    - Program is tested with relative to docker-compose paths only
    - If your watch paths are overlapping (ie: ./test and ./test/files) or are duplicated then notifications will be triggered more than once for single change


  Notes:

    - By default this program will get `docker-compose.yml` file and will watch every volume on every service.
    - You can specify multiple docker-compose files.
    - If you want to watch just some of services be sure to pass -s argument for every docker-compose file.
    - You can pass -f * to use `docker-compose.yml` file
    - You can pass -s * to watch every service
    - You can pass just -f or -s argument
    - Selecting volumes to watch is currently not supported


  Examples:

    $ docker-windows-notifier --file * --service * -f docker-compose.dev.yml -s node
    Watch every service of `docker-compose.yml` and `node` service of `docker-compose.dev.yml`

    $ docker-windows-notifier -s node,python
    Watch `node` and `python` services of `docker-compose.yml`

Behind the scenes

The whole idea is taken from docker-windows-volume-watcher. When file is changed on host then it is chmodded on container to have save privileges as it already has. This causes notification on container filesystem, but because Windows doesn't know about privileges at containers and is not notified back (like it would with touch for example) so it doesn't get into infinite loop of detecting changes.

But why did you rewrite something that already exists?

I found docker-windows-volume-watcher to be troublesome. It just throws errors with both Python 2 and Python 3 and it looks I am not alone with this.

Also the usage is not the same, mine version focuses on docker-compose files.

Limitations

Same as docker-windows-volume-watcher:

  • file deletions are not propageted (but this probably could be worked around, we'll see)
  • stat and chmod are required on containers, but I didn't heard about Linux not having those

Plus:

  • cwd should be the same as location of docker-compose file (this may be fixed in the future if needed)

Some words for people looking for help:

Docker windows doesn't refresh or reload. Windows docker synchronization problem. Windows docker with webpack. File system watch does not work with mounted volumes.

License

MIT