merofeev / docker-windows-volume-watcher

A tool to notify Docker contianers about changes in mounts on Windows.
MIT License
188 stars 30 forks source link

Doesn't Work for WSL2 #18

Open omaraltayyan opened 4 years ago

omaraltayyan commented 4 years ago

Running this command in Windows subsystem for linux 2 seems to break it.

this is the message i get for my container:


WARNING:root:Bind of container web_1 was skipped since it has invalid source path /run/desktop/mnt/host/d/user/project_dir
jeremybalog commented 4 years ago

I can confirm this isn't working with same error on WSL2.

WARNING:root:Bind of container ueg-web_app_1 was skipped since it has invalid source path /run/desktop/mnt/host/c/Users/Jeremy/Documents/GitHub/ueg-web

omaraltayyan commented 4 years ago

I can confirm this isn't working with same error on WSL2.

WARNING:root:Bind of container ueg-web_app_1 was skipped since it has invalid source path /run/desktop/mnt/host/c/Users/Jeremy/Documents/GitHub/ueg-web

Sadly for WSL2 file watch commands don't work anymore, this seemed like a possible workaround, the other one is moving files to inside of WSL2's directory but this breaks a lot of windows software we use since it's a mounted folder

lozanotc7 commented 3 years ago

Hello, You can modify the docker_bind_to_windows_path function in the container_monitor.py scritp. Adding a different regular expression and checking both, the old and new one and then making the exe file again. For example this worked for me:

` def docker_bind_to_windows_path(path):

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

match = re.match(expr, path)
match2 = re.match(expr2, path)

if not match:
    if not match2:
        return None
    else:
        return '%s:\\%s' % match2.groups()
else:
    return '%s:\\%s' % match.groups()`
bunglegrind commented 2 years ago

Hello, You can modify the docker_bind_to_windows_path function in the container_monitor.py scritp. Adding a different regular expression and checking both, the old and new one and then making the exe file again. For example this worked for me:

` def docker_bind_to_windows_path(path):

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

match = re.match(expr, path)
match2 = re.match(expr2, path)

if not match:
    if not match2:
        return None
    else:
        return '%s:\\%s' % match2.groups()
else:
    return '%s:\\%s' % match.groups()`

You're my saviour!