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

Cant Deploy in Windows Docker #1

Open
wickedyoda opened this issue May 2, 2023 · 1 comment
Open

Cant Deploy in Windows Docker #1

wickedyoda opened this issue May 2, 2023 · 1 comment

Comments

@wickedyoda
Copy link

Windows 11 Enterprise
Docker Desktop 4.18.0 (104112)
Docker integrated into WSL2 Linux Install

From within WSL2 Debian linux:

traver@abcwhyme:~$ docker run -d --name yacht_api --restart unless-stopped -p 3000:3000 -v /var/run/docker.sock:/var/run/docker.sock -v /config:yacht_data ghcr.io/selfhostedpro/yacht-api:main
docker: Error response from daemon: invalid volume specification: '/run/desktop/mnt/host/wsl/docker-desktop-bind-mounts/Debian/01d0ea696869632ca69da251f24e240d02568620b21f5f327df24ca685cef5a1:yacht_data': invalid mount config for type "bind": invalid mount path: 'yacht_data' mount path must be absolute.
See 'docker run --help'.

From Window Command:

PS C:\Users\trave> docker run -d --name yacht_api --restart unless-stopped -p 8001:3000 -v /var/run/docker.sock:/var/run/docker.sock -v /config:yacht2 ghcr.io/selfhostedpro/yacht-api:main
docker: Error response from daemon: invalid volume specification: '/config:yacht2': invalid mount config for type "bind": invalid mount path: 'yacht2' mount path must be absolute.
See 'docker run --help'.
PS C:\Users\trave> docker run -d --name yacht_api --restart unless-stopped -p 8001:3000 -v /var/run/docker.sock:/var/run/docker.sock -v config:yacht2 ghcr.io/selfhostedpro/yacht-api:main
docker: Error response from daemon: invalid volume specification: 'config:yacht2': invalid mount config for type "volume": invalid mount path: 'yacht2' mount path must be absolute.
See 'docker run --help'.
PS C:\Users\trave> docker volume create yacht_data
yacht_data
PS C:\Users\trave>

Supporting Info:
image

image

@wickedyoda
Copy link
Author

I had a brain fart to what I read last night

So default docker volume location is /var/lib/docker/volume/vol_name this is an absolute path as per linux because it contains no spaces.

Docker in WSL is using a Debian WSL2 installed host, its seeing the volume data location as machine-UUID-something/mnt/c/program files/docker/... because its seeing the path with "program files" its not seen as an absolute path. In Windows the with a path needs to be absolute but contains spaces, you add a " around it. Making it "machine-UUID-something/mnt/c/program files/docker/..."

Thats why docker kept saying unable to mount because it path must be absolute. The path showing program files error, i disregarded at the time as not being sufficient and didn't add to my screenshots. I found this from the powershell prompt in Windows.

When you open a debian prompt and run docker from within it, is where it shows the "machine-UUID-something/mnt/c/program files/docker/..." path because its how WSL translates.

In WSL2, you browse the local C drive by going to /mnt/c/... for your path. If you have multiple drives then your have c, d, e, and so on...

Not breaking it down to elementary here thinking you dont know, but its helped me ration it out in my head. Your be amazed what my brain can process to theory of a dead man at 75mph...

So, my question is how do we correct this? When I get home, im gonna try a direct bind mount to c:\docker\volume a path with no spaces within windows, already absolute. Will let you know.

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

1 participant