简体   繁体   中英

The username or password is incorrect when launching Docker from Visual Studio 2019

So, I'm very new to Docker and I'm trying to use it to containerize an ASP.NET (Framework 4.7.2) application. My platform is Windows 10 and the application is to run under a Windows container. Here's what I've done:

  1. Click on "Add -> Docker Support..." when right-clicking the project in Visual Studio.
  2. Waiting for it to generate a Dockerfile.
  3. Clicking "Run".

A generic 500 IIS error pops up when Chrome launches, and it opens at IP 172.26.102.145 rather than localhost:port, like it normally does when running without Docker. I looked at the event logs and this is what I see:

exec's CreateProcess() failed [module=libcontainerd exec=9c32d86647bc2b4b4207c447f15433d06603297dd01513445405b7841e9aa64c container=fbe41e9f4206b4b8ba3c789c7e0514e313589182e90c36e0a71b7d6cd74e17e5 namespace=moby error=container fbe41e9f4206b4b8ba3c789c7e0514e313589182e90c36e0a71b7d6cd74e17e5 encountered an error during hcsshim::System::CreateProcess: failure in a Windows system call: The user name or password is incorrect. (0x52e)
[Event Detail:  Provider: 00000000-0000-0000-0000-000000000000]
[Event Detail:  Provider: 00000000-0000-0000-0000-000000000000]
[Event Detail: onecore\vm\compute\management\orchestration\vmhostedcontainer\processmanagement.cpp(173)\vmcomputeagent.exe!00007FF7FF789F4B: (caller: 00007FF7FF73E13A) Exception(4) tid(4c0) 8007052E The user name or password is incorrect.
    CallContext:[\Bridge_ProcessMessage\VmHostedContainer_ExecuteProcess] 
Provider: 00000000-0000-0000-0000-000000000000] extra info: {"CommandLine":"cmd.exe /C \"ECHO 192.168.1.71    host.docker.internal \u003e\u003e %systemroot%\\system32\\drivers\\etc\\hosts \u0026 ECHO 192.168.1.71    gateway.docker.internal \u003e\u003e %systemroot%\\system32\\drivers\\etc\\hosts\"","User":"Administrator","WorkingDirectory":"C:\\inetpub\\wwwroot","Environment":{"COMPLUS_ForceENC":"1","COMPLUS_NGenProtectedProcess_FeatureEnabled":"0","DEV_ENVIRONMENT":"1","ROSLYN_COMPILER_LOCATION":"C:\\RoslynCompilers\\tools","VBCSCOMPILER_TTL":"604800"},"CreateStdInPipe":true,"CreateStdOutPipe":true,"CreateStdErrPipe":true,"ConsoleSize":[0,0]}]

I read elsewhere that the issue may be because of the IP? I ran the following command in Powershell to fetch a different one that I thought would work:

docker inspect <container_id>

But the IP was the same under "Networks/nat/IPAddress".

I also tried disabling firewalls/antivirus as well as logging into my account on Docker Desktop. I'm not sure what I'm supposed to authenticate, my Microsoft login somehow? I feel like I'm making a rookie mistake!

Oh, and here's my Dockerfile:

#Depending on the operating system of the host machines(s) that will build or run the containers, the image specified in the FROM statement may need to be changed.
#For more information, please see https://aka.ms/containercompat 

FROM mcr.microsoft.com/dotnet/framework/aspnet:4.8-windowsservercore-ltsc2019
ARG source
WORKDIR /inetpub/wwwroot
COPY ${source:-obj/Docker/publish} .

This problem turned out to be a red herring, with the real issue found by looking at IIS application logs within the docker container. I suggest anyone facing this to open up powershell in the container by running:

docker container exec -it <container-name/id> powershell

Then browse the application logs with:

Get-EventLog -LogName Application -Newest 15

You may see an issue there. Also, you can try running this in the container to see if an error is spit out:

Invoke-WebRequest http://localhost

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM