for-win icon indicating copy to clipboard operation
for-win copied to clipboard

version 2.2.0.0: Error while creating mount source path '/host_mnt/c/code': mkdir /host_mnt/c/code: file exists

Open jlouros opened this issue 6 years ago • 50 comments

  • [x] I have tried with the latest version of my channel (Stable or Edge)
  • [x] I have uploaded Diagnostics
  • Diagnostics ID: 5742C908-05AC-4B28-87FE-A1FF54758C53/20200121184954

Expected behavior

should be able to attach volume point to a folder on host

Actual behavior

C:\Program Files\Docker\Docker\resources\bin\docker.exe: Error response from daemon: error while creating mount source path '/host_mnt/c/code': mkdir /host_mnt/c/code: file exists.

Information

  • Is it reproducible? Yes, every time I try to attach a volume pointing to C:\code
  • Is the problem new? Yes, after updating Docker Desktop to version 2.2.0.0
  • Did the problem appear with an update? Yes, with version 2.2.0.0. Worked fine on the previous version
  • Windows Version: Windows 10 Pro version 1909 (OS Build 18363.592)
  • Docker Desktop Version: 2.2.0.0 (42247)
  • Are you running inside a virtualized Windows e.g. on a cloud server or on a mac VM: No

image

Steps to reproduce the behavior

  1. run docker run --rm -v c:/code:/data alpine ls /data

jlouros avatar Jan 21 '20 18:01 jlouros

@jlouros thanks for your report.

Could you check the canonical case of your directory C:\code -- is it C:\Code or C:\code (or C:\CoDe ...). I've managed to reproduce a similar error by

PS > mkdir \code
PS > docker run --rm -v c:/Code:/data alpine ls /data
C:\Program Files\Docker\Docker\resources\bin\docker.exe: Error response from daemon: error while creating mount source path '/host_mnt/c/Code': mkdir /host_mnt/c/Code: file exists.

PS > docker run --rm -v c:/code:/data alpine ls /data
PS >

but I don't know if this is this is the same error you saw or not.

Unfortunately I can't find the diagnostics upload :( Could you try re-uploading diagnostics? Or failing that the 2 interesting log files would be

  • AppData\Local\Docker\log.txt
  • AppData\Roaming\Docker\log\vm\lifecycle-server.log Could you upload those somewhere and send me a link?

djs55 avatar Jan 21 '20 19:01 djs55

hi @djs55

the problem was the canonical case. If I change it to docker run --rm -v c:/Code:/data alpine ls /data (capital C) it works fine.

I was a bit concerned because docker-compose also started failing for me. Powershell (I guess all Windows-based shells) accept both c:\code and c:\Code. Since I use relative paths on docker-compose.yml, the startup would fail because the current that was c:\code\my-proj (instead of using c:\Code\my-proj)

Thanks for your help

jlouros avatar Jan 21 '20 20:01 jlouros

after checking the logs I saw the error message:

[19:58:53.178][GoBackendProcess  ][Info   ] time="2020-01-21T19:58:53Z" msg="rejecting access to file using non-canonical name code (canonical name is Code)"

I guess it should be level Error instead of Info

jlouros avatar Jan 21 '20 20:01 jlouros

@jlouros thanks for the fast confirmation.

I recently made the fileserver more strict about case to avoid problems where the file contents it cached multiple times in the VM under different names, because only the canonical filename would be invalidated when the file on the host has changed. The extra-strictness on docker run -v was not intended. The error message is also terrible. Maybe I can improve the error message at least.

djs55 avatar Jan 21 '20 20:01 djs55

I suspect we could automatically rewrite mount sources to the canonical path as well. We'll talk about it tomorrow :)

simonferquel avatar Jan 21 '20 20:01 simonferquel

Reopening: even though there's a workaround, we still need to fix it.

stephen-turner avatar Jan 22 '20 09:01 stephen-turner

I'm experiencing this issue too, using both Git Bash, and WSL. my Diagnostic upload id is 2F761B85-0512-4FD3-A883-643AE53C0115/20200122154524 if that helps. The same docker-compose projects worked fine before this Docker Desktop 2.2 update. And fwiw, i'm not seeing the "non-canonical name" error message in my logs.

tmuka avatar Jan 22 '20 16:01 tmuka

I'm also having this issue, with a slight variation. I have the following volume mount in my docker-compose.yml:

    prometheus:
        image: prom/prometheus
        ports:
            - "9090:9090"
        volumes:
            - ./config/prometheus.yml:/etc/prometheus/prometheus.yml
            - prometheus_data:/prometheus

Though I have the correct casing in my docker-compose.yml, when docker-compose converts ./config/prometheus.yml to an absolute path, it will use lowercase for the remainder of the path that it fills in. So if the docker-compose file is in C:\Foo, it will use /host_mnt/c/foo/config/prometheus.yml. Then I get this error:

ERROR: for master_prometheus_1  Cannot start service prometheus: error while creating mount source path '/host_mnt/c/foo/config/prometheus.yml': mkdir /host_mnt/c/foo: file exists

I'll get this in my log file:

[19:41:56.517][GoBackendProcess  ][Info   ] time="2020-01-22T19:41:56-05:00" msg="rejecting access to file using non-canonical name foo (canonical name is Foo)"

SirRippovMaple avatar Jan 23 '20 00:01 SirRippovMaple

@trumpi exactly the behaviour I'm seeing, caused by an uppercase character in my absolute path. I've worked around the problem by checking out to a new path that includes no uppercase characters.

aaronmorgan avatar Jan 23 '20 02:01 aaronmorgan

We have a fix incoming for this one, thanks for the (numerous) repro cases 👍

simonferquel avatar Jan 23 '20 09:01 simonferquel

Sorry our internal repo PR auto-closed the ticket, we’ll keep it open until it’s been confirmed fixed.

mat007 avatar Jan 23 '20 15:01 mat007

IDEs and Tools like SAM CLI internally use regular casing when mounting code and it's not possible to change that, which means that until this issue is solved it all the tools that rely on docker mount will fail.

manucohenyashar avatar Jan 23 '20 16:01 manucohenyashar

We have a new private build that (we believe) fixes this bug. https://download-stage.docker.com/win/stable/42579/Docker%20Desktop%20Installer.exe. Please try it and let us know how you get on.

stephen-turner avatar Jan 31 '20 20:01 stephen-turner

@stephen-turner - thank you, it works!

SirRippovMaple avatar Feb 01 '20 14:02 SirRippovMaple

I'm afraid the private build proposed by @stephen-turner did not work for me, I am still seeing the same error.

Versions:

  • Windows 10 Pro: version 10.0.18363
  • Docker Desktop Community edition: version 2.2.0.1 (42579)
  • Docker Compose: version 1.25.3

Diagnostics ID D054EF4A-AB53-4724-BCC3-607227D90AC2/20200202103217

Seeing the error as this:

ERROR: for wordpress  Cannot start service wordpress: error while creating mount source path '/host_mnt/c/projects/health-check/.docker/config/php-fpm/php.ini': mkdir /host_mnt/c/projects/health-check/.docker/config/php-fpm: file exists

When trying to just do a docker-compose up from my project directory in C:/projects/health-check (I've also double-checked the casing, and also tried using the full path name instead of the relative one), using the repository at https://github.com/WordPress/health-check/tree/develop

This was functioning as expected prior to the 2.2.0 update

Clorith avatar Feb 02 '20 10:02 Clorith

I'm afraid the private build proposed by @stephen-turner did not work for me, I am still seeing the same error.

Versions:

  • Windows 10 Pro: version 10.0.18363
  • Docker Desktop Community edition: version 2.2.0.1 (42579)
  • Docker Compose: version 1.25.3

Diagnostics ID D054EF4A-AB53-4724-BCC3-607227D90AC2/20200202103217

Seeing the error as this:

ERROR: for wordpress  Cannot start service wordpress: error while creating mount source path '/host_mnt/c/projects/health-check/.docker/config/php-fpm/php.ini': mkdir /host_mnt/c/projects/health-check/.docker/config/php-fpm: file exists

When trying to just do a docker-compose up from my project directory in C:/projects/health-check (I've also double-checked the casing, and also tried using the full path name instead of the relative one), using the repository at https://github.com/WordPress/health-check/tree/develop

This was functioning as expected prior to the 2.2.0 update

+1 same here.. ERROR: for mydb Cannot start service mydb: error while creating mount source path '/host_mnt/c/link/mydb': mkdir /host_mnt/c: file exists

24githubs avatar Feb 02 '20 14:02 24githubs

I just tried it out and it worked great !!!

My test was to start a new AWS SAM application with VS code and start a debugging session. As I described in issue 5573 https://github.com/docker/for-win/issues/5573 I used to get the error "("error while creating mount source path '/host_mnt/c/Users/{my user name}/AppData/Local/Temp/aws-toolkit-vscode/vsctkDZvlgv/output/awsToolkitSamLocalResource': mkdir /host_mnt/c/Users/{my user name}: file exists")"

but now with the private build it worked !!!

Thanks

Manu

On Fri, Jan 31, 2020 at 3:21 PM Stephen Turner [email protected] wrote:

We have a new private build that (we believe) fixes this bug. https://download-stage.docker.com/win/stable/42579/Docker%20Desktop%20Installer.exe. Please try it and let us know how you get on.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/docker/for-win/issues/5516?email_source=notifications&email_token=ABULBR3BA2W6MENFXDLYSCDRASB4JA5CNFSM4KJYNTX2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEKP4LNI#issuecomment-580896181, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABULBR4IWJSUQ5M5TOM6Y2TRASB4JANCNFSM4KJYNTXQ .

manucohenyashar avatar Feb 03 '20 13:02 manucohenyashar

For users experiencing an issue with the private build, can you check if it works when using the same exact casing as the file path on windows?

simonferquel avatar Feb 03 '20 14:02 simonferquel

We have a new private build that (we believe) fixes this bug. https://download-stage.docker.com/win/stable/42579/Docker%20Desktop%20Installer.exe. Please try it and let us know how you get on.

My project came up the first time after installing the private build, but then after stopping it and trying to bring it up a 2nd time I get the same file exists errors as before.

[tmuka@WRKSTN-92L31S2:/d/www/example.org]$ docker-compose down -v
Stopping exampleorg_phpmyadmin_1 ... done
Stopping exampleorg_mysql_1      ... done
Removing exampleorg_phpmyadmin_1 ... done
Removing exampleorg_wordpress_1  ... done
Removing exampleorg_mysql_1      ... done
Removing network exampleorg_default
Removing volume exampleorg_mysql
[tmuka@WRKSTN-92L31S2:/d/www/example.org]$ docker-compose up --force-recreate
Creating network "exampleorg_default" with the default driver
Creating volume "exampleorg_mysql" with default driver
Creating exampleorg_wordpress_1 ... error
Creating exampleorg_mysql_1     ...

Creating exampleorg_mysql_1     ... done
Creating exampleorg_phpmyadmin_1 ... done

ERROR: for wordpress  Cannot start service wordpress: error while creating mount source path '/host_mnt/d/www/example.org': mkdir /host_mnt/d/www/example.org: file exists
ERROR: Encountered errors while bringing up the project.
[tmuka@WRKSTN-92L31S2:/d/www/example.org]$

my volume mount config in docker-compose.yml is relative like this, without any case specified.

    volumes:
      - "./:/var/www/html/wp-content"
    volumes:
      - "mysql:/var/lib/mysql"

edit: my diagnostics id 2F761B85-0512-4FD3-A883-643AE53C0115/20200203145833

tmuka avatar Feb 03 '20 14:02 tmuka

@tmuka @Clorith thanks for your diagnostics / repro cases. We identified a case where a panic makes the whole grpcFuse go nuts. We are writing a fix.

simonferquel avatar Feb 03 '20 15:02 simonferquel