我的aspnetcore docker项目构建,但是当我单击Docker按钮(或按F5)运行时我得到
Severity Code Description Project File Line Suppression State
Error MSB4018 The "PrepareForLaunch" task failed unexpectedly.
Microsoft.DotNet.Docker.CommandLineClientException: Creating network "dockercompose1627893588_default" with the default driver
Building pswebapi
Service 'pswebapi' failed to build: Get https://registry-1.docker.io/v2/microsoft/aspnetcore/manifests/1.1: unauthorized: incorrect username or password.
For more troubleshooting information, go to http://aka.ms/DockerToolsTroubleshooting ---> Microsoft.DotNet.Docker.CommandLineClientException: Creating network "dockercompose1627893588_default" with the default driver
Building pswebapi
Service 'pswebapi' failed to build: Get https://registry-1.docker.io/v2/microsoft/aspnetcore/manifests/1.1: unauthorized: incorrect username or password
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.DotNet.Docker.DockerComposeClient.<ExecuteAsync>d__18.MoveNext()
--- End of inner exception stack trace ---
at Microsoft.DotNet.Docker.DockerComposeClient.<ExecuteAsync>d__18.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.DotNet.Docker.DockerWorkspace.<PrepareForLaunchAsync>d__14.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.DotNet.Docker.BuildTasks.DockerBaseTask.Execute()
at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
at Microsoft.Build.BackEnd.TaskBuilder.<ExecuteInstantiatedTask>d__26.MoveNext() docker-compose C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\Microsoft\VisualStudio\v15.0\Docker\Microsoft.VisualStudio.Docker.Compose.targets 192
我确实有C:使用Docker设置共享。 我正在使用Linux容器
Dockerfile是
FROM microsoft/aspnetcore:1.1
ARG source
WORKDIR /app
EXPOSE 80
COPY ${source:-obj/Docker/publish} .
ENTRYPOINT ["dotnet", "PsWebApi.dll"]
我已升级到最新的nuget包。
答案 0 :(得分:8)
user id
和对应的 email
(用于登录dockerhub )在这种情况下实际上是两件事。
需要id
,用户名的 而不是email
来获得images
。
解决
通过执行
在两者之间进行切换 > docker logout
然后在命令行上
> docker login
,然后使用您的id
登录。
请注意,使用电子邮件登录后,可以在docker站点上找到id
。
系统将提示您输入凭据。同样,对于该用户名,请不要使用电子邮件地址。
答案 1 :(得分:1)