Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

failed to build: Get https://registry-1.docker.io/v2/microsoft/aspnetcore/manifests/1.1: unauthorized: incorrect username or password

My aspnetcore docker project builds, however when I click the Docker button ( or press F5) to run I get

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 

I do have C: shared using Docker Settings. I am using linux containers

Dockerfile is

FROM microsoft/aspnetcore:1.1
ARG source
WORKDIR /app
EXPOSE 80
COPY ${source:-obj/Docker/publish} .
ENTRYPOINT ["dotnet", "PsWebApi.dll"]

I have upgraded to the latest nuget packages.

like image 647
Kirsten Avatar asked Jul 09 '17 06:07

Kirsten


2 Answers

The user id and the corresponding email which is used to login to dockerhub are actually two different things in this context.

One needs the id, of the username, and not the email to get images.


Resolve

by changing between the two by doing a

> docker logout

on the command line then

> docker login

and login with your id.

Note that the id can be found on the docker site after you login with your email.

You will be prompted for you for the credentials. Also again, for that user name, do not use the email address.

like image 79
ΩmegaMan Avatar answered Oct 27 '22 04:10

ΩmegaMan


I am also facing the same issue in latest ASP.NET Core template. And the following fix works for me.

  • Open the Package Manager Console window.
  • Run the command docker logout.

enter image description here

Then run/debug(F5) the app again.

One side note is that you need to switch to Windows container in Docker. Otherwise you will see another error: image operating system "windows" cannot be used on this platform.

like image 38
Thuc Nguyen Avatar answered Oct 27 '22 04:10

Thuc Nguyen