Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
AntoineWeber opened this issue Dec 21, 2020 · 11 comments

Comments

@AntoineWeber
Copy link

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 ?

@mikekberg
Copy link

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

@AntoineWeber
Copy link
Author

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.

@masquevil
Copy link

same question 👀

@masquevil
Copy link

I open a PR: #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?

@tp86
Copy link

tp86 commented Apr 22, 2021

I have the same issue

@bensoutendijk
Copy link

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

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.

@rizktouma
Copy link

@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.

@bensoutendijk
Copy link

@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.

@GeorgesAlexis
Copy link

@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])/(.*)$')

@laggingreflex
Copy link

laggingreflex commented May 3, 2022

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.

@KingofGnome
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

9 participants