无法使用Docker Windows更改卷上文件/文件夹的权限 [英] Can't change the permissions of files/folders on a volume with Docker windows

查看:108
本文介绍了无法使用Docker Windows更改卷上文件/文件夹的权限的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试使用Docker Windows更改卷上文件/文件夹的权限.但是权限没有意外更改.

I tried to change the permissions of files/folders on a volume with Docker windows. But the permissions are not changed, unexpectedly.

环境:主机:Windows 10 ProDocker版本17.09.0-CE,构建afdb6d4

Environment: Host: Windows 10 Pro Docker version 17.09.0-ce, build afdb6d4

复制步骤:

  1. 使用下面的Dockerfile构建映像.
  2. 运行带有卷的容器.
  3. 更改文件/文件夹的权限.

Dockerfile:

Dockerfile:

FROM microsoft/windowsservercore
CMD [ "powershell" ]

输出:

D:\data\docker\sample>docker build -t sample .
Sending build context to Docker daemon  1.272GB
Step 1/2 : FROM microsoft/windowsservercore
 ---> 2cddde20d95d
Step 2/2 : CMD powershell
 ---> Running in dd207fe8b262
 ---> e0203df155cd
Removing intermediate container dd207fe8b262
Successfully built e0203df155cd
Successfully tagged sample:latest

D:\data\docker\sample>docker run -d --name sample --mount type=volume,source=sample_volume,target=C:/data sample ping -t localhost
5a21f41d63de321e912ec3b99010a062d2e04d5f99145c6cd8bf649d3fbbebf1

D:\data\docker\sample>docker exec -i sample cmd
Microsoft Windows [Version 10.0.14393]
(c) 2016 Microsoft Corporation. All rights reserved.

C:\>cd c:\data
cd c:\data

c:\data>MKDIR foo
MKDIR foo

c:\data>ECHO hoge > foo\hoge.txt
ECHO hoge > foo\hoge.txt

c:\data>cacls foo
cacls foo
c:\data\foo NT AUTHORITY\SYSTEM:(OI)(CI)(ID)F
            BUILTIN\Administrators:(OI)(CI)(ID)F
            CREATOR OWNER:(OI)(CI)(IO)(ID)F
            BUILTIN\Users:(OI)(CI)(ID)R
            BUILTIN\Users:(CI)(ID)(special access:)
                                  FILE_WRITE_DATA
                                  FILE_APPEND_DATA
                                  FILE_WRITE_EA
                                  FILE_WRITE_ATTRIBUTES



c:\data>cacls foo\hoge.txt
cacls foo\hoge.txt
c:\data\foo\hoge.txt NT AUTHORITY\SYSTEM:(ID)F
                     BUILTIN\Administrators:(ID)F
                     BUILTIN\Users:(ID)R


c:\data>cacls foo /T /E /G everyone:F
cacls foo /T /E /G everyone:F
processed dir: c:\data\foo
processed file: c:\data\foo\hoge.txt

c:\data>cacls foo
cacls foo
c:\data\foo NT AUTHORITY\SYSTEM:(OI)(CI)(ID)F
            BUILTIN\Administrators:(OI)(CI)(ID)F
            CREATOR OWNER:(OI)(CI)(IO)(ID)F
            BUILTIN\Users:(OI)(CI)(ID)R
            BUILTIN\Users:(CI)(ID)(special access:)
                                  FILE_WRITE_DATA
                                  FILE_APPEND_DATA
                                  FILE_WRITE_EA
                                  FILE_WRITE_ATTRIBUTES



c:\data>cacls foo\hoge.txt
cacls foo\hoge.txt
c:\data\foo\hoge.txt NT AUTHORITY\SYSTEM:(ID)F
                     BUILTIN\Administrators:(ID)F
                     BUILTIN\Users:(ID)R

我找到了一个文档,该文档指出不能在Linux容器上更改卷上文件/文件夹的权限.但是我找不到有关Windows容器的文档.Windows容器是否支持 Windows容器上的卷上文件/文件夹的权限更改?

I found a document which says that the permissions of files/folders on volumes cannot be changed on Linux containers. But I could not found documentation about Windows containers. Does Windows containers support the permission changes of file/folders on a volume on Windows containers?

链接:

推荐答案

在您提到的链接中,似乎Windows的docker不支持更改文件权限.

From the link that you mentioned in question, it seems that docker for windows does not support changing file permissions.

Docker for Windows当前基于以下方式实现主机安装的卷:Microsoft SMB协议,它不支持细粒度的chmod控制这些权限.

Docker for Windows currrently implements host-mounted volumes based on the Microsoft SMB protocol, which does not support fine-grained, chmod control over these permissions.

这篇关于无法使用Docker Windows更改卷上文件/文件夹的权限的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆