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

Cannot open read-only files in bind-mounted volume #6016

Closed
2 tasks done
ricmzn opened this issue Mar 13, 2020 · 21 comments
Closed
2 tasks done

Cannot open read-only files in bind-mounted volume #6016

ricmzn opened this issue Mar 13, 2020 · 21 comments

Comments

@ricmzn
Copy link

ricmzn commented Mar 13, 2020

  • I have tried with the latest version of my channel (Stable or Edge)
  • I have uploaded Diagnostics
  • Diagnostics ID: 17DF2026-6081-4C91-B251-658F4666D41C/20200313180148

Expected behavior

Read-only files shared between the Windows host and a Docker container should still be readable from the container.

Actual behavior

Anything that tries to open the file gets a "File not found" or "Operation not permitted" error.

Information

This happened after a recent Docker Desktop update, although I can't remember which version was installed before (it was a few months old). I first noticed this when a project failed its test run because it was built in a Docker container, and one of the build tools tried to read files in the project's .git directory, some of which are made read-only by default.

  • Windows Version: Windows 10 Pro 1909 (Build 18363.720)
  • Docker Desktop Version: 2.2.0.4 (Stable)
  • Virtualized Windows: No, it's installed directly on the machine

Steps to reproduce the behavior

  • Create a text file on the desktop with some content
  • Run a container from cmd with the command line: docker run -it -v "C:\Users\{yourname}\Desktop\{filename}:/test" ubuntu
  • Check the permissions of the file with ls -l and try to read its contents with cat:
    01
  • Right click the file on Windows, open properties, check the "read-only" box, and confirm
  • Run the Ubuntu container with the same parameters as above
  • Output of ls -l and cat after the change (note that ls can read the new permissions correctly):
    02
@omcandido
Copy link

I was about to open the same issue.
Drupal installations crash with the latest update, as the settings.php file (which has 444 permissions) cannot be read.
The previous release (Docker Desktop Community 2.2.0.3) works fine.

@stephen-turner
Copy link
Contributor

@djs55 Did we change something in this area between 2.2.0.3 and 2.2.0.4?

@theryansmith
Copy link

I wonder if this is also related to the fact that windows mounted volumes are also now case-sensitive? #6013

@djs55
Copy link

djs55 commented Mar 16, 2020

@ricmzn thanks for the report and the very clear repro steps. I could reproduce this locally and identified the problem: unfortunately we mis-parse the Linux file open flags and attempt to open the file read/write instead of read-only. This was a regression caused by the fix to relax the file locking by adjusting the file open flags (FILE_SHARE_ etc). I've got a proposed fix and a test case to cover it.

@djs55
Copy link

djs55 commented Mar 17, 2020

I deleted a comment about a prototype build because I just discovered it was incomplete - sorry for the confusion.

@djs55
Copy link

djs55 commented Mar 17, 2020

I now have a more complete prototype build (based on top of the recent stable 2.2.0.4). If you have the time to try it let me know how it goes: https://download-stage.docker.com/win/stable/43542/Docker%20Desktop%20Installer.exe If it still doesn't work, please upload a fresh set of diagnostics and quote the id here.

@cleathley
Copy link

@djs55 Can also confirm this also fixes a lot of composer install issues people were having (though the file system wasn't RO in mycase). Thanks

@m-h-k
Copy link

m-h-k commented Mar 18, 2020

I had the same issue using git inside a VSCode remote container, and your prototype build fixes it. Thank you very much!

@cakoops
Copy link

cakoops commented Mar 18, 2020

I had in the recent stable 2.2.0.4 the following issue:
I could not read a file from C# code. Got permission denied error.

@djs55
Your prototype fixed the issue.

@ricmzn
Copy link
Author

ricmzn commented Mar 18, 2020

@djs55 I can also confirm that the linked prototype fixes the issue, with no visible regressions in the project I used for the initial diagnosis. Thanks a lot!

@hastarin
Copy link

And just another confirmation that this worked for an issue I had with VS Code and a Remote Container.

@rfay
Copy link
Contributor

rfay commented Mar 19, 2020

I hit this, just with a git fetch/checkout inside the container. The build in #6016 (comment) fixed it for me @djs55

A good automated test to add while fixing this would probably be just the "git checkout in container"

@minusdavid
Copy link

Yikes...

@rfay
Copy link
Contributor

rfay commented Mar 25, 2020

@djs55 any projection about a release to fix this? More Windows folk stumble on it every day. The natives are getting restless :)

@mat007
Copy link
Member

mat007 commented Mar 25, 2020

@rfay the current plan is to release an Edge version at the end of the month (March) then a Stable based on it mid-April.

@rfay
Copy link
Contributor

rfay commented Mar 25, 2020

Yay for releasing things on edge before stable! Thanks, looking forward to both.

@tai-yi
Copy link

tai-yi commented Apr 1, 2020

My issue is resolved with Enable the experimental WSL 2 based engine

@stephen-turner
Copy link
Contributor

This is now fixed in 2.2.0.5 stable and 2.2.3.0 edge, so closing this ticket.

@bbqrob
Copy link

bbqrob commented Jun 9, 2020

Hi @stephen-turner , can you point to the commit, which fixes the problem. Got a similar problem, running docker-ee 19.03.8 on a MS Windows Server 2019 host (virtualized in VMWare ESXi) which serves as an Teamcity build agent.

@stephen-turner
Copy link
Contributor

@bbqrob I can't point to the commit because the product is not open source. But in any case, your problem must be different, as you're running the EE Engine on Windows Server, and the bug was in the Docker Desktop code. I suggest you open a ticket in the moby/moby repository instead.

@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 14, 2020
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