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

[WSL2] bind mount (--mount) with a directory does not exist does not generate errors #10422

Closed
3 tasks done
sarisia opened this issue Feb 19, 2021 · 2 comments
Closed
3 tasks done

Comments

@sarisia
Copy link

sarisia commented Feb 19, 2021

  • I have tried with the latest version of Docker Desktop
  • I have tried disabling enabled experimental features
  • I have uploaded Diagnostics
  • Diagnostics ID: 00EF965D-AD0F-462B-B261-776161C213A0/20210219042536

Actual behavior

With WSL Integration, bind mounting the directory that does not exist in the host
does not generate errors and automatically creates the directory instead.

[sarisia@Marine test]$ docker run --mount "type=bind,src=$(pwd)/bindtest,dst=/bindtest" --name bindtest -d nginx
ab2d73dda77767915206486ec9953ab520a6ca34e3a1eba238d1d1f50d2887a3
[sarisia@Marine test]$ ls -al
total 12
drwxr-xr-x 3 sarisia sarisia 4096 Feb 19 13:20 .
drwxr-xr-x 7 sarisia sarisia 4096 Feb 19 13:20 ..
drwxr-xr-x 2 root    root    4096 Feb 19 13:20 bindtest

Expected behavior

docker run should generate errors, as described in the docs

Tested the same command with the Ubuntu VM (VMWare Workstation Player):

sarisia@ubuntu:~/run$ sudo docker run --mount "type=bind,src=$(pwd)/bindtest,dst=/bindtest" --name bindtest -d nginx
docker: Error response from daemon: invalid mount config for type "bind": bind source path does not exist: /home/sarisia/run/bindtest.
See 'docker run --help'.
`docker version` in Ubuntu VM
sarisia@ubuntu:~/run$ sudo docker version
Client: Docker Engine - Community
 Version:           20.10.3
 API version:       1.41
 Go version:        go1.13.15
 Git commit:        48d30b5
 Built:             Fri Jan 29 14:33:21 2021
 OS/Arch:           linux/amd64
 Context:           default
 Experimental:      true

Server: Docker Engine - Community
 Engine:
  Version:          20.10.3
  API version:      1.41 (minimum version 1.12)
  Go version:       go1.13.15
  Git commit:       46229ca
  Built:            Fri Jan 29 14:31:32 2021
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          1.4.3
  GitCommit:        269548fa27e0089a8b8278fc4fc781d7f65a939b
 runc:
  Version:          1.0.0-rc92
  GitCommit:        ff819c7e9184c13b7c2607fe6c30ae19403a7aff
 docker-init:
  Version:          0.19.0
  GitCommit:        de40ad0

Information

  • Windows Version:
Edition	Windows 10 Education
Version	20H2
Installed on	‎11/‎2/‎2020
OS build	19042.804
Experience	Windows Feature Experience Pack 120.2212.551.0
  • Docker Desktop Version: 3.1.0 (51484)
  • WSL2 or Hyper-V backend?: WSL2
  • Are you running inside a virtualized Windows e.g. on a cloud server or a VM: No

docker version in WSL2:

[sarisia@Marine test]$ docker version
Client: Docker Engine - Community
 Cloud integration: 1.0.7
 Version:           20.10.2
 API version:       1.41
 Go version:        go1.13.15
 Git commit:        2291f61
 Built:             Mon Dec 28 16:17:34 2020
 OS/Arch:           linux/amd64
 Context:           default
 Experimental:      true

Server: Docker Engine - Community
 Engine:
  Version:          20.10.2
  API version:      1.41 (minimum version 1.12)
  Go version:       go1.13.15
  Git commit:       8891c58
  Built:            Mon Dec 28 16:15:28 2020
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          1.4.3
  GitCommit:        269548fa27e0089a8b8278fc4fc781d7f65a939b
 runc:
  Version:          1.0.0-rc92
  GitCommit:        ff819c7e9184c13b7c2607fe6c30ae19403a7aff
 docker-init:
  Version:          0.19.0
  GitCommit:        de40ad0

Steps to reproduce the behavior

  1. make sure you have no bindtest directory in the host:
[sarisia@Marine test]$ ls -al
total 8
drwxr-xr-x 2 sarisia sarisia 4096 Feb 19 13:37 .
drwxr-xr-x 7 sarisia sarisia 4096 Feb 19 13:20 ..
  1. run the container with bind mount:
[sarisia@Marine test]$ docker run --mount "type=bind,src=$(pwd)/bindtest,dst=/bindtest" --name bindtest -d nginx
ab2d73dda77767915206486ec9953ab520a6ca34e3a1eba238d1d1f50d2887a3
  1. step 2 should be error, but it's not. Instead, bindtest directory is created.
[sarisia@Marine test]$ ls -al
total 12
drwxr-xr-x 3 sarisia sarisia 4096 Feb 19 13:20 .
drwxr-xr-x 7 sarisia sarisia 4096 Feb 19 13:20 ..
drwxr-xr-x 2 root    root    4096 Feb 19 13:20 bindtest
@docker-robott
Copy link
Collaborator

Issues go stale after 90 days of inactivity.
Mark the issue as fresh with /remove-lifecycle stale comment.
Stale issues will be closed after an additional 30 days of inactivity.

Prevent issues from auto-closing with an /lifecycle frozen comment.

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.
/lifecycle stale

@docker-robott
Copy link
Collaborator

Closed issues are locked after 30 days of inactivity.
This helps our team focus on active issues.

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.
/lifecycle locked

@docker docker locked and limited conversation to collaborators Jul 23, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants