【发布时间】:2018-11-30 11:25:57
【问题描述】:
我正在尝试使用 Jenkins 构建一个 .NET 应用程序。 Jenkins 实例在 Docker 容器中运行。
我的Jenkinsfile如下:
pipeline {
agent {
docker {
image 'microsoft/dotnet:2.1-sdk'
registryUrl 'https://index.docker.io/v1/'
}
}
stages {
stage('Build') {
steps {
sh 'dotnet build MyApplication/Application.csproj -c Release -o /app'
}
}
stage('Test') {
steps {
sh 'dotnet test MyApplication/Application.csproj -c Release -r /results'
}
}
}
}
当我尝试构建时,我在 Jenkins 构建输出中看到以下错误:
System.UnauthorizedAccessException: Access to the path '/.dotnet' is denied. ---> System.IO.IOException: Permission denied
--- End of inner exception stack trace ---
at System.IO.FileSystem.CreateDirectory(String fullPath)
at System.IO.Directory.CreateDirectory(String path)
at Microsoft.Extensions.EnvironmentAbstractions.DirectoryWrapper.CreateDirectory(String path)
at Microsoft.DotNet.Configurer.FileSentinel.Create()
at Microsoft.DotNet.Configurer.DotnetFirstTimeUseConfigurer.Configure()
at Microsoft.DotNet.Cli.Program.ConfigureDotNetForFirstTimeUse(INuGetCacheSentinel nugetCacheSentinel, IFirstTimeUseNoticeSentinel firstTimeUseNoticeSentinel, IAspNetCertificateSentinel aspNetCertificateSentinel, IFileSentinel toolPathSentinel, Boolean hasSuperUserAccess, DotnetFirstRunConfiguration dotnetFirstRunConfiguration, IEnvironmentProvider environmentProvider)
at Microsoft.DotNet.Cli.Program.ProcessArgs(String[] args, ITelemetry telemetryClient)
at Microsoft.DotNet.Cli.Program.Main(String[] args)
“.dotnet”文件夹似乎在 Docker 容器中受到保护。有没有办法获得读/写权限,或者改变它的位置?当我 bash 进入容器时,我似乎找不到该文件夹。
感谢您的帮助。
【问题讨论】:
标签: .net docker jenkins asp.net-core build