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
Persistent volumes get lost in Kubernetes on Docker Desktop for Windows/WSL2 #7023
Comments
I had the similar issue with you, but it's a slight bit different, I was trying to mount as hostPath. If you feeling unclear about the above post, here is my working example:
Here I use Ubuntu-18.04 as WSL integration. |
Actually, it does help. Although this makes things unnecessary complicated for the developers (I intended to provide them with a consistent deployment over all OS choices for their development systems), it helped to get that at least running under WSL2. One thing though, if storing the files in a cross-mounted directory not located on a windows drive, the mount seems to be a tmpfs - so if you really need persistent data, better not store it in a freshly created directory but on Still, this is just a workaround, not a real solution. At least this behaviour should be documented officially somewhere. Which doesn't seem to be the case right now. |
I totally agree. |
I have same issue. I mount host folder
This is the output
Host folder file not shown in the container mount path,and container directory file not shown in host path. version: 2.3.0.3, older version (2.2.x) works fine. And |
@zssng Your problem is a little bit different here. But yeah, it would be good to have your case supported as well. |
We are experiencing the same issues. Data stored using This makes Persistent Volumes unusable and broken. |
The same here volume data lost ... |
Same here when using Docker Desktop for win 19.3. Volumes can be successfully created under /C/Users/xx/.docker/volumes/, which is mapped in MobyVM under /host_mnt/c/.... However, in MobyVM path, I can see the files created by container, but in Windows, the directory is empty. After restarted Docker Desktop, all changes on the persistent volume are gone. |
Hey Docker guys, can someone from you comment on this issue, please? It's been open for almost half a year without any reaction from your side. Thank you. This issue makes the Deploy on Kubernetes feature unusable. |
+1 |
For what its worth this happens on docker for mac as well and it's really annoying. |
I was able to find a workaround for Windows by using this type of path with the
The |
@wanderrful Which part of that is the workaround? |
At least in my case, The I didn't include the corresponding PVC and Storage resource, but the PV I posted there was the critical piece of the puzzle. For me, at least. |
Looking at the initial request, it appears the request is to have a hostPath mount from Docker Desktop-bundled k8s into a different WSL2 distribution? Docker Desktop is not running in your current WSL2 distribution, it has its own, and runs inside mount namespaces under that, for isolation, so you can't access it from the same root, as the initial request was trying to do. So I suspect the solution is the same as for mounting from the Windows host (above), except instead of To find out, become root in WSL while Docker Desktop is running, and run
I don't have any other WSL distributions installed, so all see there is Docker's own WSL distributions.
That said, those appear to be specific mounts, rather than just the root filesystem for those distributions, so I don't know whether other WSL2 distributions will appear there. I think this is a bind-mount of the
However, per microsoft/WSL#4577 (comment) it's possible other distros won't auto-mount there, if So the solution at #7023 (comment) is nearly correct, except before using a path under Per microsoft/WSL#5177 (comment) and microsoft/WSL#5851, there's an issue that the mount points are lost on WSL shutdown, which is tricky to solve because it would require starting other distros before starting the docker desktop k8s stack. For contrast, if you let the
I'm not sure where that actually lives physically, I suspect it's a virtual disk mounted from somewhere else as it shows up as |
Issues go stale after 90 days of inactivity. Prevent issues from auto-closing with an If this issue is safe to close now please do so. Send feedback to Docker Community Slack channels #docker-for-mac or #docker-for-windows. |
/remove-lifecycle stale |
Issues go stale after 90 days of inactivity. Prevent issues from auto-closing with an If this issue is safe to close now please do so. Send feedback to Docker Community Slack channels #docker-for-mac or #docker-for-windows. |
/remove-lifecycle stale |
I was thinking about this. It would be feasible (but not trivial) to write a CSI driver which could mount like It'd probably work a lot like the CSI Proxy system used to support CSI on Windows, except hopefully it would be able to launch the target WSL distro directly to host the back-end, rather than needing to be started externally, as the backend of the CSI Proxy requires. That would avoid the use of magic In theory such a thing would work not just in Docker Desktop for Windows's k8s implementation, but any other WSL2-hosted k8s environment too. |
Issues go stale after 90 days of inactivity. Prevent issues from auto-closing with an If this issue is safe to close now please do so. Send feedback to Docker Community Slack channels #docker-for-mac or #docker-for-windows. |
Closed issues are locked after 30 days of inactivity. If you have found a problem that seems similar to this, please open a new issue. Send feedback to Docker Community Slack channels #docker-for-mac or #docker-for-windows. |
Expected behavior
When creating a new persistent volume and new persistent volume claim that gets used in a pod, I expect to find the contents created by the pod in the given file path.
Data stored in the persistent volume is still available after a reboot, since it should be stored in wsl2's file system.
Actual behavior
Information
Steps to reproduce the behavior
Create a persistent volume and claim
Ruin a deployment using the persistent volume claim
The text was updated successfully, but these errors were encountered: