Cannot build netcoreapp2.0 with 2.0.3-sdk-nanoserver-1709 with docker run -v PathToProject:PathInDocker
Hello everyone, i hope anyone can help me out with the following issue.
Short Recap:
I am trying to build a netcoreapp2.0 project with mircosoft/dotnet:2.0.3-sdk-nanoserver-1709 as follows:
docker run -it --rm -v ${PWD}:c:/data microsoft/dotnet:2.0.3-sdk-nanoserver-1709
When trying to build the project within the container with
dotnet build
i run into
C:\Program Files\dotnet\sdk\2.0.3\NuGet.targets(102,5): error : Access to the path is denied. [C:\data\testProject.csproj]
Steps to reproduce the issue
- Either use an existing project or create a new one with
dotnet new console - either cd into the project directory and run
docker run -it --rm -v ${PWD}:c:/data microsoft/dotnet:2.0.3-sdk-nanoserver-1709or rundocker run -it --rm -v PathToProject:c:/data microsoft/dotnet:2.0.3-sdk-nanoserver-1709where PathToProject is the path to the project directory - within the container change into the directory where the project files are accessible
cd data dotnet buildordotnet run
Expected behavior
Successful build.
Actual behavior
Error Message:
C:\Program Files\dotnet\sdk\2.0.3\NuGet.targets(102,5): error : Access to the path is denied. [C:\data\testProject.csproj]
Output of docker version
Client:
Version: 17.09.0-ce
API version: 1.32
Go version: go1.8.3
Git commit: afdb6d4
Built: Tue Sep 26 22:40:09 2017
OS/Arch: windows/amd64
Server:
Version: 17.09.0-ce
API version: 1.32 (minimum version 1.24)
Go version: go1.8.3
Git commit: afdb6d4
Built: Tue Sep 26 22:50:27 2017
OS/Arch: windows/amd64
Experimental: true
Output of docker info
Containers: 32
Running: 0
Paused: 0
Stopped: 32
Images: 5
Server Version: 17.09.0-ce
Storage Driver: windowsfilter
Windows:
Logging Driver: json-file
Plugins:
Volume: local
Network: ics l2bridge l2tunnel nat null overlay transparent
Log: awslogs etwlogs fluentd json-file logentries splunk syslog
Swarm: inactive
Default Isolation: hyperv
Kernel Version: 10.0 16299 (16299.15.amd64fre.rs3_release.170928-1534)
Operating System: Windows 10 Enterprise
OSType: windows
Architecture: x86_64
CPUs: 8
Total Memory: 15.88GiB
Name: ID-CH-0302
ID: E7DZ:FCTT:IN2C:FNPT:2KDM:KCLB:FSNC:XLSC:YYOD:MCFW:BPJG:HXTM
Docker Root Dir: C:\ProgramData\Docker
Debug Mode (client): false
Debug Mode (server): true
File Descriptors: -1
Goroutines: 25
System Time: 2017-12-04T20:09:51.2118434+01:00
EventsListeners: 0
Registry: https://index.docker.io/v1/
Experimental: true
Insecure Registries:
127.0.0.0/8
Live Restore Enabled: false
Regards
@kdrblkbs, what are ACLs on the folders you are volume mapping into the container? Do machine users have access? Have you tried running with -u ContainerAdministrator?
@PatrickLang - FYI - A question that should be answered by https://github.com/MicrosoftDocs/Virtualization-Documentation/issues/673.
Hello,
@MichaelSimons providing -u ContainerAdministrator did not help. However i was suspecting that it must be somehow related to ACLs, which is why i tried a bunch of stuff within the container without any success. But finally i ran docker from an administrator shell and then it worked. Before that i was running docker "normally" from a powershell with my usual user account (which is also a local admin on the machine). Is this behavior correct? The ACLs for the directory the test project is in are as follows:
FileSystemRights : FullControl
AccessControlType : Allow
IdentityReference : NT-AUTHORITY\SYSTEM
IsInherited : True
InheritanceFlags : ContainerInherit, ObjectInherit
PropagationFlags : None
FileSystemRights : FullControl
AccessControlType : Allow
IdentityReference : Default\Administrators
IsInherited : True
InheritanceFlags : ContainerInherit, ObjectInherit
PropagationFlags : None
FileSystemRights : FullControl
AccessControlType : Allow
IdentityReference : MyUserAccount
IsInherited : True
InheritanceFlags : ContainerInherit, ObjectInherit
PropagationFlags : None
Regards
@kdrblkbs here is a detailed description of permission model (https://github.com/MicrosoftDocs/Virtualization-Documentation/blob/live/virtualization/windowscontainers/manage-containers/container-storage.md#permissions) Hopefully, this addresses your concern. Please let me know if you have questions..
Closing issue as there have been no further questions. Feel free to reopen, log a new issue, or open an issue on the Documentation if there are unanswered questions.
Hello.. I am trying to run an image on Azure Windows Server 1709 with containers machine. I have mapped volume using -v