-
Notifications
You must be signed in to change notification settings - Fork 288
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
--mount
bind-mount creates non-existing directory, contradicting documentation
#11958
Comments
probably same #10422 |
You are right, it looks indeed a lot like #10422; I must have missed that when looking for existing issues. However, that issue is locked, so I would have had to create a new issue either way. |
I'm hesitant to create a new issue but here's what I was experiencing, and the workaround I finally discovered. Can someone suggest whether it is a new issue or not? Expected behaviourBind mounts (whether in Actual behaviourBind mounts in the format above end up pointing to an obscure directory that Windows sees as created within \\wsl.localhost\docker-desktop-data\mnt\wsl\docker-desktop-data\tarcache\entries\docker.tar\ some_long_hex_id\containers\services\docker\rootfs\mnt\c\users\public\downloads (in the example above) InformationWindows Version: Windows 11 21H2 (OS Build 22000.376) WorkaroundDon't use PowerShell to deploy containers. Use Ubuntu bash shell within WSL to execute EDIT: the WSLg/browser steps quoted for portainer.io below might have been unnecessary. Testing shows that as long as portainer.io is installed entirely within WSL Ubuntu, subsequent container deployment from https://localhost:9443/ in a host browser seems to work as expected (that is, portainer.io sees bind-mount paths through WSL Ubuntu eyes. This did not happen when using a portainer.io container deployed using that company's WSL2 instructions!)
Later on, inspecting the configuration of those deployed containers, the bind mounts will appear to have been changed to host paths of /run/desktop/mnt/host/wsl/docker-desktop-bind-mounts/Ubuntu/some_long_hex_id but when you browse \wsl.localhost\docker-desktop-data\mnt\wsl\docker-desktop-bind-mounts\Ubuntu in Windows, those long hex directories are inaccessible and show 0 bytes as their size - making me think they are symlinks. Docker Desktop can now start and stop these containers, access CLI, etc. from the Windows host. This is the only way that I have been able to make containers share directories and files with the Windows host, or WSL Ubuntu for that matter. |
@brstreetlaw, to me that sounds like a different issue (though the maintainers might think differently about this). My report was only about the fact that the documentation contradicts the actual behavior regarding whether non-existent directories are created. However, for me the directories were created in the correct location. |
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. |
Still the case with Docker version 20.10.16, build aa7e414 /remove-lifecycle stale |
Thank you for raising this issue again (I'm the author of #10422). I've confirmed this is still the case with Docker Desktop. My workaround is remove Docker Desktop and install docker-ce. It works very well for me for months Just install docker-ce as described in the official docs
I feel installing docker-ce manually is a bit of a pain so hope this issue resolves... |
There hasn't been any activity on this issue for a long time. Mark the issue as fresh with a /lifecycle stale |
Still the case for Docker Desktop 4.14.1 (91661), Docker version 20.10.21, build baeda1f |
/lifecycle frozen |
/remove-lifecycle stale @docker-desktop-robot seems pretty pointless to me. It only causes a lot of noise and closes valid issues. And apparently anyone can disable it with |
Also a problem on Linux! I use Starting a container with a bind-mount using a file that does not exist does not yield an error at startup. Instead, some part of Docker creates a empty directory at the file path. This is very confusing for our operations people, because when they check where the file is supposed to be, they see something and occasionally miss that it's not a file but instead a directory, and waste lots of time. I'd really like docker to fail at start if anything is missing on the host that's supposed to be mounted (directory or file). Alternately, maybe you can give us a new option like "--fail-on-missing-volume" to preserve the existing behavior but allow these problems to be detected immediately. Thanks for listening. |
This is still happening on Linux. |
@Gibbz, this report here is about the behavior of Docker Desktop for Windows, and also this repository |
According to the documentation
docker run --mount
withtype=bind
should fail when the directory on the host does not exist:From what I have heard (have not tested it), this is also the way Docker behaves on Linux.
This can cause confusion when on Windows it creates the non-existing directory (contradicting the documentation) but the equivalent command fails on Linux.
Actual behavior
The non-existing directory on the host is created
Expected behavior
Docker should fail (as described in the documentation) because the directory does not exist on the host
Information
Steps to reproduce the behavior
does-not-exist
in your current directoryThe text was updated successfully, but these errors were encountered: