Using DevPod on Windows with WSL2
Is your feature request related to a problem?
I tested DevPod on my Windows 10 with Docker. Docker is installed in WSL2 in an Ubuntu 22.04 but the docker.exe executable in Windows which accesses the Docker Engine in WSL.
When I try to create a Workspace from a github repo (but same result with local folder, as well), DevPod tries to use the Windows path for Docker volume binding, which is incorrect inside WSL.
[11:30:07] debug Acquire workspace lock...
[11:30:07] debug Acquired workspace lock...
[11:30:07] info Creating devcontainer...
[11:30:07] debug Inject and run command: 'C:\Program Files\DevPod\devpod-cli.exe' agent workspace up --workspace-info 'H4sIAAAAAAAA/5yTX2+bMBTFv8p0n3EgkAbwW9V2arQ/qToyaZOlyrEviVeDkW1opyjffXJI02zdXvaGwffec+7vsIMnYx9dxwUC3YGSQKExGkWv0UIE/e9viMSa99qTaT4vURSZSEUymxYXhM9lJiCC2miJFihcUcZWDq1jbCFwbdaMTSQOnZGMCdN6fPaOsWM/xk4yHGPnAjolfG8RKGy97xyNY4udccob+5Oohm/QTTbKb/t179AeGrd+IkwTF2lalLMii8t1PZvWRUJyrHMynWJJSp4n5CKdizov5glmeZhkzaAO2nfQ8iaMlEY8HlSYzivTuvDpenn14eb+4e6yug3Hgev+7Oo+gsXny6tq8XVRfXuoFp9ulqsK6G6/30fQcLFVbVj0PgIl8WyS6bAdnDASQwtnejsC2Sh/f/J7toTR8sHnaVs/3Otz6CIs8iC7Ug06z5sOKKRJmpGkINOySkqaJTSZf4cINHd+5VD++8YRWXA6IgsT+AZbH2RqI7gGCt72GFbJ/fYYgTtrNpY3794rHdBe43AXEjAmgQitJvgcSqR5arXhcnX/8e82tak9cdt4rIwtauQOXfxSGA/JJJvMIAJ8RjHu+LFfo23RoxvPR0h096LwBFi1znMdLNRcO4SAS2i1fOX+5tc4APwD3Nuc3C6/VOPw/w7OLwAAAP//AQAA///dCuvbpAMAAA==' --debug
[11:30:07] debug Execute command locally
[11:30:07] info Use C:\Users\Icebob\.devpod\agent\contexts\default\workspaces\moleculer as workspace dir
[11:30:07] debug Created logger
[11:30:07] debug Received ping from agent
[11:30:07] debug Clone Repository
[11:30:07] info Cloning into 'C:\Users\Icebob\.devpod\agent\contexts\default\workspaces\moleculer\content'...
[11:30:11] debug Using docker command 'docker'
[11:30:11] info Couldn't find a devcontainer.json
[11:30:11] info Try detecting project programming language...
[11:30:11] info Detected project language 'JavaScript'
[11:30:11] debug Running docker command: docker run --sig-proxy=false --mount type=bind,source=C:\Users\Icebob\.devpod\agent\contexts\default\workspaces\moleculer\content,target=/workspaces/moleculer,consistency='consistent' -l dev.containers.id=moleculer-default-1769ec83c2c04185-a6d3c -l devcontainer.metadata=[{"id":"ghcr.io/devcontainers/features/common-utils:2"},{"id":"ghcr.io/devcontainers/features/git:1"},{"id":"ghcr.io/devcontainers/features/node:1","customizations":{"vscode":{"extensions":["dbaeumer.vscode-eslint"]}}},{"remoteUser":"node","customizations":{"vscode":{"extensions":["dbaeumer.vscode-eslint"]}}},{}] -d --entrypoint /bin/sh mcr.microsoft.com/devcontainers/javascript-node -c echo Container started
trap "exit 0" 15
exec "$@"
while sleep 1 & wait $!; do :; done -
[11:30:11] info docker: Error response from daemon: invalid mount config for type "bind": invalid mount path: 'C:/Users/Icebob/.devpod/agent/contexts/default/workspaces/moleculer/content' mount path must be absolute.
[11:30:11] info See 'docker run --help'.
[11:30:11] info exit status 125
[11:30:11] info start dev container
[11:30:11] info github.com/loft-sh/devpod/pkg/devcontainer.(*Runner).runSingleContainer
[11:30:11] info D:/a/devpod/devpod/pkg/devcontainer/single.go:78
[11:30:11] info github.com/loft-sh/devpod/pkg/devcontainer.(*Runner).Up
[11:30:11] info D:/a/devpod/devpod/pkg/devcontainer/run.go:152
[11:30:11] info github.com/loft-sh/devpod/cmd/agent/workspace.(*UpCmd).devPodUp
[11:30:11] info D:/a/devpod/devpod/cmd/agent/workspace/up.go:393
[11:30:11] info github.com/loft-sh/devpod/cmd/agent/workspace.(*UpCmd).up
[11:30:11] info D:/a/devpod/devpod/cmd/agent/workspace/up.go:164
[11:30:11] info github.com/loft-sh/devpod/cmd/agent/workspace.(*UpCmd).Run
[11:30:11] info D:/a/devpod/devpod/cmd/agent/workspace/up.go:98
[11:30:11] info github.com/loft-sh/devpod/cmd/agent/workspace.NewUpCmd.func1
[11:30:11] info D:/a/devpod/devpod/cmd/agent/workspace/up.go:57
[11:30:11] info github.com/spf13/cobra.(*Command).execute
[11:30:11] info D:/a/devpod/devpod/vendor/github.com/spf13/cobra/command.go:916
[11:30:11] info github.com/spf13/cobra.(*Command).ExecuteC
[11:30:11] info D:/a/devpod/devpod/vendor/github.com/spf13/cobra/command.go:1044
[11:30:11] info github.com/spf13/cobra.(*Command).Execute
[11:30:11] info D:/a/devpod/devpod/vendor/github.com/spf13/cobra/command.go:968
[11:30:11] info github.com/loft-sh/devpod/cmd.Execute
[11:30:11] info D:/a/devpod/devpod/cmd/root.go:90
[11:30:11] info main.main
[11:30:11] info D:/a/devpod/devpod/main.go:8
[11:30:11] info runtime.main
[11:30:11] info C:/hostedtoolcache/windows/go/1.20.5/x64/src/runtime/proc.go:250
[11:30:11] info runtime.goexit
[11:30:11] info C:/hostedtoolcache/windows/go/1.20.5/x64/src/runtime/asm_amd64.s:1598
[11:30:11] info devcontainer up
[11:30:11] info github.com/loft-sh/devpod/cmd/agent/workspace.(*UpCmd).Run
[11:30:11] info D:/a/devpod/devpod/cmd/agent/workspace/up.go:100
[11:30:11] info github.com/loft-sh/devpod/cmd/agent/workspace.NewUpCmd.func1
[11:30:11] info D:/a/devpod/devpod/cmd/agent/workspace/up.go:57
[11:30:11] info github.com/spf13/cobra.(*Command).execute
[11:30:11] info D:/a/devpod/devpod/vendor/github.com/spf13/cobra/command.go:916
[11:30:11] info github.com/spf13/cobra.(*Command).ExecuteC
[11:30:11] info D:/a/devpod/devpod/vendor/github.com/spf13/cobra/command.go:1044
[11:30:11] info github.com/spf13/cobra.(*Command).Execute
[11:30:11] info D:/a/devpod/devpod/vendor/github.com/spf13/cobra/command.go:968
[11:30:11] info github.com/loft-sh/devpod/cmd.Execute
[11:30:11] info D:/a/devpod/devpod/cmd/root.go:90
[11:30:11] info main.main
[11:30:11] info D:/a/devpod/devpod/main.go:8
[11:30:11] info runtime.main
[11:30:11] info C:/hostedtoolcache/windows/go/1.20.5/x64/src/runtime/proc.go:250
[11:30:11] info runtime.goexit
[11:30:11] info C:/hostedtoolcache/windows/go/1.20.5/x64/src/runtime/asm_amd64.s:1598
[11:30:11] debug Done executing up command
[11:30:11] debug Done creating devcontainer
[11:30:11] fatal executing agent command: exit status 1
The issue is here: --mount type=bind,source=C:\Users\Icebob\.devpod\agent\contexts\default\workspaces\moleculer\content,target=/workspaces/moleculer,consistency='consistent'
Under WSL2, this path is available as /mnt/c/Users/Icebob/.devpod/agent/contexts/default/workspaces/moleculer/content/
Which solution do you suggest?
I think the solution would be adding an extra parameter to the workspace where I can override the binding path.
Which alternative solutions exist?
I've not found any solution.
Additional context
- Windows 10
- WSL2 with Ubuntu 22.04
- DevPod v0.3.4
@icebob thanks for creating this issue! Mhh makes sense, seems like we need to detect such installations and make sure to use the linux paths then.
@FabianKramm @icebob It took me a while, but when following down the code chain to look for the place to make a change I found how the path for mounts was created and found there was option to set the home dir - so instead of needing a code change I documented it in the above linked PR to update docs
I've tried but no changes. I've configured DEVPOD_HOME but got the same error:
[20:07:34] debug Created logger
[20:07:34] debug Received ping from agent
[20:07:34] debug Clone Repository
[20:07:34] info Cloning into 'C:\Users\Icebob\.devpod\agent\contexts\default\workspaces\moleculer\content'...
[20:10:19] debug Using docker command 'docker'
[20:10:19] info Couldn't find a devcontainer.json
[20:10:19] info Try detecting project programming language...
[20:10:20] info Detected project language 'JavaScript'
[20:10:20] debug Running docker command: docker run --sig-proxy=false --mount type=bind,source=C:\Users\Icebob\.devpod\agent\contexts\default\workspaces\moleculer\content,target=/workspaces/moleculer,consistency='consistent' -l dev.containers.id=moleculer-default-2ea8affdcf5445d1-d1329 -l devcontainer.metadata=[{"id":"ghcr.io/devcontainers/features/common-utils:2"},{"id":"ghcr.io/devcontainers/features/git:1"},{"id":"ghcr.io/devcontainers/features/node:1","customizations":{"vscode":{"extensions":["dbaeumer.vscode-eslint"]}}},{"remoteUser":"node","customizations":{"vscode":{"extensions":["dbaeumer.vscode-eslint"]}}},{}] -d --entrypoint /bin/sh mcr.microsoft.com/devcontainers/javascript-node -c echo Container started
trap "exit 0" 15
exec "$@"
while sleep 1 & wait $!; do :; done -
[20:10:20] info docker: Error response from daemon: invalid mount config for type "bind": invalid mount path: 'C:/Users/Icebob/.devpod/agent/contexts/default/workspaces/moleculer/content' mount path must be absolute.
[20:10:20] info See 'docker run --help'.
[20:10:20] info exit status 125
However, I think it won't solve my issue because the devpod-cli running on Windows and it needs the real Windows path, but for docker mounting needs the linux-like path.
did you try setting it to the wsl path such as /mnt/c/Users/Icebob/ ? either as env DEVPOD_HOME, or passing cli flag --devpod-home=/mnt/c/Users/Icebob/ ?
Also, i wonder if it would work if you installed/ran it in wsl. wsl devpod-cli
Yes:
with that env var it was still trying to run on windows path? Also can you try setting the DEVPOD_HOME to /mnt/c/Users/Icebob - the program will already add the .devpod/....
Why is this issue closed? With the newest devPod version its still not able to start a devcontainer from windows inside of a wsl running docker environment.
invalid mount config for type "bind": invalid mount path:
'C:/sources/myProject'
mount path must be absolute.invalid mount config for type "bind":
invalid mount path: 'C:/sources/myProject' mount path must be absolute.
Yes, this doesn't seem to work properly which is a shame.
This should not be closed. There are multiple mount related issues when using devpod-cli on WSL 2
I ended up here for the same reason, so please consider reopening it
Adding my vote for reopening the issue. It doesn't seem to be possible to use VS Code on Windows to connect to a devpod on WSL2.
Bump
I figured this out, see https://github.com/loft-sh/devpod/issues/789#issuecomment-3232907036
I’ve faced the same issue. Thanks for creating the info trail, and thanks @Neurrone for the tips — unfortunately, it didn’t work for me. Still looking for a solution.
Here, this link helped me. https://devpod.sh/docs/tutorials/docker-provider-via-wsl