VS2017构建失败-DOCKER_REGISTRY [英] VS2017 Build Fail - DOCKER_REGISTRY

查看:138
本文介绍了VS2017构建失败-DOCKER_REGISTRY的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我开始使用Docker,并熟悉.NET Core和Visual Studio2017。我创建了一个新的名为 WebApplicationCore21的Web应用程序(剃刀页面),并启用了Docker支持,并获得了不错的Dockerfile。

I'm getting started with Docker and familiar with .NET Core and Visual Studio 2017. I've created a new Web Application (Razor Pages) named "WebApplicationCore21" with Docker Support enabled and receive a nice Dockerfile out the gate.

FROM microsoft/dotnet:2.1-aspnetcore-runtime-nanoserver-1709 AS base
WORKDIR /app
EXPOSE 62911
EXPOSE 44323

FROM microsoft/dotnet:2.1-sdk-nanoserver-1709 AS build
WORKDIR /src
COPY WebApplicationCore21/WebApplicationCore21.csproj WebApplicationCore21/
RUN dotnet restore WebApplicationCore21/WebApplicationCore21.csproj
COPY . .
WORKDIR /src/WebApplicationCore21
RUN dotnet build WebApplicationCore21.csproj -c Release -o /app

FROM build AS publish
RUN dotnet publish WebApplicationCore21.csproj -c Release -o /app

FROM base AS final
WORKDIR /app
COPY --from=publish /app .
ENTRYPOINT ["dotnet", "WebApplicationCore21.dll"]

尽管项目构建正常,它运行错误(F5),说明:

While the project builds ok, it errors on run (F5), stating:

Description: The DOCKER_REGISTRY variable is not set. Defaulting to a blank string.
Project: docker-compose
File: Microsoft.VisualStudio.Docker.Compose.targets
Line: 363

已验证步骤


  • 在主板和主板上启用Hyper-V Windows 10专业版

  • 已安装适用于Windows的Docker

  • 可以同时登录Docker Hub和客户端

  • 交换式Docker客户端从Linux到Windows容器

  • Enabled Hyper-V on motherboard and in Windows 10 Pro
  • Docker for Windows installed
  • Can login both Docker Hub and client
  • Switched Docker client to Windows containers from Linux

我还注意到,尽管我可以使用集线器凭据登录Docker客户端,但尝试运行 docker登录在PowerShell中并使用相同的用户名/密码会产生以下内容:

I've also noticed that although I can log into Docker client using my hub credentials, attempting to run docker login in PowerShell and using the same username/password produces the following:

Error response from daemon: Get https://registry-1.docker.io/v2/: unauthorized: incorrect username or password

这可能有用或无关。我只需要从VS2017运行。

Maybe this is helpful or perhaps unrelated; all I need is to run from VS2017.

推荐答案

我找到了解决方案今天上午基于未经授权:用户名或密码错误错误。

I found my solution this morning based on the unauthorized: incorrect username or password error.

当我在系统托盘中检查Windows的Docker时,我使用Docker Hub电子邮件地址登录。 Docker for Windows认为这是可以接受的,这具有误导性。这样做会给与其交互的应用程序(如VS2017)带来麻烦。使用我的Docker Hub用户名来解决它。

When I checked Docker for Windows in the system tray, I was logged in using my Docker Hub email address. Docker for Windows finds this acceptable, which is misleading. Doing so causes trouble for apps it interacts with like VS2017. Using my Docker Hub username instead solved it.

这篇关于VS2017构建失败-DOCKER_REGISTRY的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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