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

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

问题描述

我正在开始使用 Docker,并熟悉 .NET Core 和 Visual Studio 2017.我创建了一个名为WebApplicationCore21"的新 Web 应用程序(Razor 页面),启用了 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

验证步骤:

  • 在主板和 Windows 10 专业版中启用 Hyper-V
  • 已安装 Windows 版 Docker
  • 可以同时登录 Docker Hub 和客户端
  • 将 Docker 客户端从 Linux 切换到 Windows 容器

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

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.

当我在系统托盘中检查 Docker for Windows 时,我是使用我的 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天全站免登陆