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

Unable to move files in volume directory in Windows docker container #1058

Open
dtretyakov opened this issue Sep 1, 2017 · 9 comments
Open

Unable to move files in volume directory in Windows docker container #1058

dtretyakov opened this issue Sep 1, 2017 · 9 comments

Comments

@dtretyakov
Copy link

@dtretyakov dtretyakov commented Sep 1, 2017

Expected behavior

File move succeeds.

Actual behavior

File move fails with Access is denied.

Information

Diagnostic ID : F74EE66C-752F-4676-B9C3-2D44D291D24C/2017-09-01_19-21-39
Dockerfile:

FROM microsoft/nanoserver
VOLUME c:/volume

Steps to reproduce the behavior

  1. Create a new image based on microsoft/nanoserver / microsoft/windowsservercore with volume
  2. Run it docker run -it -v C:\Users\User\Documents\volume:c:/volume volume-nanoserver powershell
  3. Create a file and try to rename/move:
PS C:\volume> Move-Item file.txt file2.txt
Move-Item : Access to the path is denied.
At line:1 char:1
+ Move-Item file.txt file2.txt
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : PermissionDenied: (C:\volume\file.txt:FileInfo) [Move-Item], UnauthorizedAccessException
    + FullyQualifiedErrorId : MoveFileInfoItemUnauthorizedAccessError,Microsoft.PowerShell.Commands.MoveItemCommand

In non volume directory move succeeds.

@Crevax

This comment has been minimized.

Copy link

@Crevax Crevax commented Sep 28, 2017

What permissions do you have on the folder? I was running into the same issue until I gave Modify access to the Authenticated Users principal.

@dtretyakov

This comment has been minimized.

Copy link
Author

@dtretyakov dtretyakov commented Sep 29, 2017

Hi, I use default permissions for everything, dockerd service is running under LocalSystem account, this folder was created under the User account. I could not find anything regarding specific access settings for Authenticated Users in docker documentation.

@Crevax

This comment has been minimized.

Copy link

@Crevax Crevax commented Sep 29, 2017

I'll be first to admit I'm not a Windows security/system expert, so maybe using Authenticated Users isn't the correct Principal (and I'm using the term Principal since that's what's used when setting folder permissions since it's not restricted to just User assignment). Regardless, I think the issue you're coming across is still due to your folder's permissions.

Since the folder was created by your User account (and the folder is in your user's specific directory), your Container's user probably doesn't have the right permissions to move the file.

When I was running into the same issue, I could make files and folders within the mounted volume. So it was weird that moving/renaming files was forbidden. But again I'm not an expert on how that's handled in Windows. Maybe someone with more knowledge in that regard can chime in. I wasn't able to find anything around permissions for mounting volumes in a Windows container either. I just know relaxing the permissions on my folder solved the issue for me.

I just chose Authenticated Users after duplicating the setup in a different folder, checked that everything worked there, and looked at the different permissions. Hope that helps clear things up!

@docker-desktop-robot

This comment has been minimized.

Copy link
Collaborator

@docker-desktop-robot docker-desktop-robot commented Mar 27, 2018

Issues go stale after 90d of inactivity.
Mark the issue as fresh with /remove-lifecycle stale comment.
Stale issues will be closed after an additional 30d 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

@dtretyakov

This comment has been minimized.

Copy link
Author

@dtretyakov dtretyakov commented Mar 28, 2018

/lifecycle frozen

@GCSBOSS

This comment has been minimized.

Copy link

@GCSBOSS GCSBOSS commented Jul 23, 2019

I have the same problem with stable version.

@JeffCyr

This comment has been minimized.

Copy link

@JeffCyr JeffCyr commented Aug 16, 2019

I don't know if it's the same issue but I had a similar problem with Docker for Windows 19.03.1 on Windows 10 1903. I could create/edit/delete files in a volume but I could not rename or move the file, it gave the error "DirectoryNotFound". The same operation was possible outside the volume.

I recreated the container and the issue was gone, I'm not sure how to reproduce

@spinico

This comment has been minimized.

Copy link

@spinico spinico commented Sep 10, 2019

Also similar issue for me, but in my case I had the File Server Resource Manager (Windows Feature) installed on the Windows Server host which caused problem to move files in a volume within a container. I had to uninstall the mentioned feature to make it work again.

@JeffCyr

This comment has been minimized.

Copy link

@JeffCyr JeffCyr commented Sep 24, 2019

Related issue: moby/moby#38256

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
7 participants
You can’t perform that action at this time.