docker-windows-volume-watcher icon indicating copy to clipboard operation
docker-windows-volume-watcher copied to clipboard

WARNING:root:Bind of container was skipped since it has invalid source path

Open AntoineWeber opened this issue 4 years ago • 11 comments

Hello,

One of my docker container requires access to a directory where it tracks file changes within that directory (using the watchdog library).

I tried using docker-windows-volume-watcher to maintain the watchdog alerts within the docker container, however when I launch it, I get the error "WARNING:root:Bind of container was skipped since it has invalid source path" where the path itself is a standard windows path : C:\path\to\the\directory_containing_the_files

Am I missing something here ?

AntoineWeber avatar Dec 21 '20 14:12 AntoineWeber

I'm getting the same error, could it be problems with path? My path has a directory with a '-' in it

mikekberg avatar Dec 27 '20 09:12 mikekberg

I rolled back my docker desktop version to 2.1.0.5 and it works. Hence I think the problem comes from an uncompatibility with the docker desktop version.

AntoineWeber avatar Dec 27 '20 10:12 AntoineWeber

same question 👀

masquevil avatar Feb 25 '21 15:02 masquevil

I open a PR: https://github.com/merofeev/docker-windows-volume-watcher/pull/21 But I'm not familiar with python and don't know how to build this on my local PC. So actually I have not verify this. Could anyone verify this or tell me what to do?

masquevil avatar Feb 25 '21 15:02 masquevil

I have the same issue

tp86 avatar Apr 22 '21 10:04 tp86

https://github.com/merofeev/docker-windows-volume-watcher/blob/41d3d29f8bf731117d0e49cad73345cc8af02a22/docker_volume_watcher/container_monitor.py#L27

I'm not experienced in python or docker, but I see that the paths are tested using regex which searches for "host_mnt" directory.

All my docker mounts are at a path like /mnt/c/Users/... which the below regex does not match.

re.compile('^(?:/host_mnt)?/([a-zA-Z])/(.*)$')

Maybe the Docker update changed the paths where containers are mounted, and so that is why downgrading Docker is a supposed workaround?

Seems like an easy fix to change this regex to ^(?:/host_mnt|/mnt)?/([a-zA-Z])/(.*)$ and support paths that begin with just /mnt.

bensoutendijk avatar May 13 '21 20:05 bensoutendijk

@bensoutendijk I am facing the same issue now. I cloned the repository and changed the regex. How did you build the exe after you made the changes? I tried Pyinstaller but the generated exe is exiting right after I launch it and I am no longer getting any log messages.

rizktouma avatar Aug 17 '21 12:08 rizktouma

@rizktouma Sorry but I never did end up getting this to work, so I am not sure I can help you. I didn't get to the build step.

bensoutendijk avatar Aug 17 '21 16:08 bensoutendijk

@rizktouma

You could change the python script directly where pip has installed this package.

pip3 show docker-windows-volume-watcher

Output :

$ pip3 show docker-windows-volume-watcher Name: docker-windows-volume-watcher Version: 1.2.0 Summary: A tool to notify Docker contianers about changes in mounts on Windows. Home-page: http://github.com/merofeev/docker-windows-volume-watcher Author: Mikhail Erofeev Author-email: [email protected] License: MIT Location: c:\users\alexis\appdata\local\programs\python\python310\lib\site-packages Requires: docker, future, watchdog Required-by:

Go at the location and edit your files:

LINE 27: expr = re.compile('^(?:/mnt)?/([a-zA-Z])/(.*)$')

GeorgesAlexis avatar Mar 26 '22 14:03 GeorgesAlexis

The function (in which the above line 27 is) says:

def docker_bind_to_windows_path(path):
    """
    Converts Hyper-V mount path to Windows path (e.g. [/host_mnt]/C/some-path -> C:/some-path).
    """
    expr = re.compile('^(?:/host_mnt)?/([a-zA-Z])/(.*)$')

but in my case path is already C:\some-path (no /host_mnt or /mnt or even /C/ to begin with). So making it redundant (retuning path as-is) is what makes it work in my case.

EDIT: No longer working for some reason (I haven't made any major changes to the system - just some Windows Updates). The path above has changed to /run/desktop/mnt/host/… so replacing host_mnt with it is what works now.

laggingreflex avatar May 03 '22 08:05 laggingreflex

Searching for a solution for the skipped since it has invalid source path i found this issue (like after banging my had around a --reload not working-problem for hours nefore finding the docker-windows-volume-watcher after all).

Sadly none of the above fixes did anything for me. However manipulating the problematic def docker_bind_to_windows_path(path):-Function i've noticed my 'problematic' path 'C:/Users:/...' looks already like the desired outcome of the function?!

So i dumped in a return path to see what happend and...it works (for me). I don't know whats wrong with the functions, the mountpath and regex-matching, but for me, putting in a

def docker_bind_to_windows_path(path):
    if path.starthwith('C:'):
        return path

does the job for now. Ofc. having only a C-Drive on my Laptop 😉.

Maybe it will help someone, its not a fix in any ways, just another workaround.

KingofGnome avatar Jul 16 '22 14:07 KingofGnome