Unauthorized: authentication required

Since a couple of days, I am trying to build a docker file but always getting unauthorized: authentication required.

Here is the contents of the Dockerfile:

FROM microsoft/aspnet

# Download and extract BlogEngine.NET project files

RUN powershell -Command
$ErrorActionPreference = ‘Stop’;
Invoke-WebRequest -Method Get -Uri https://blogengine.codeplex.com/downloads/get/1566660 -OutFile c:\BlogEngineNETSrc.zip ;
Expand-Archive -Path c:\BlogEngineNETSrc.zip -DestinationPath c:\inetpub\wwwroot\blogengine ;
Remove-Item c:\BlogEngineNETSrc.zip -Force

Configure Web App

COPY buildapp.ps1 C:/
RUN powershell.exe C:\buildapp.ps1

#FIX DNS issues currently in Windows Containers
RUN powershell set-itemproperty -path ‘HKLM:\SYSTEM\CurrentControlSet\Services\Dnscache\Parameters’ -Name ServerPriorityTimeLimit -Value 0 -Type DWord

Overwrite Web.config file so that web service points to db service

COPY Web.config C:/inetpub/wwwroot/blogengine
EXPOSE 81

Download starts, some completes then I see

Sending build context to Docker daemon 24.06kB
Step 1/7 : FROM microsoft/aspnet
latest: Pulling from microsoft/aspnet
3889bb8d808b: Downloading [=====> ] 431.2MB/4.07GB
449343c9d7e2: Downloading [================> ] 431.2MB/1.304GB
ccd8f322a2de: Download complete
5358f1f8c04f: Download complete
27fb1950158d: Download complete
4447c3ffe068: Download complete
94eeeaf0d3bd: Download complete
fe1d276c8d64: Downloading
25871a4250c9: Waiting
b53cc298d0b7: Waiting
unauthorized: authentication required

My docker for windows is
Client:
Version: 17.12.0-ce
API version: 1.35
Go version: go1.9.2
Git commit: c97c6d6
Built: Wed Dec 27 20:05:22 2017
OS/Arch: windows/amd64

Server:
Engine:
Version: 17.12.0-ce
API version: 1.35 (minimum version 1.24)
Go version: go1.9.2
Git commit: c97c6d6
Built: Wed Dec 27 20:15:52 2017
OS/Arch: windows/amd64
Experimental: false

The Docker for Windows community forum is place where users can meet and discuss Docker for Windows and related technologies.
If you encounter problems with Docker for Windows, we recommend:

Finally, if your issue has not been addressed elsewhere, running:

  • :whale: :arrow_right: Settings :arrow_right: Diagnose & Feedback :arrow_right: Open Issues.

This forum is not an official product support or issue reporting channel.

In fact, it seems that "Docker for Windows " was corrupt, maybe because of the different upgrades since 2 years. I removed it completely and re-installed it, in Windows containers mode everything works fine but not Linux containers mode. It crashes. I opened a thread at https://github.com/docker/for-win/issues/1589#issuecomment-359322046
since 3 days but no response yet from the team

For some reason, your docker daemon tries to authenticate yourself to docker hub. This happens only with a layer of the docker image.

This is an old discussion but, I’ve encountered an issue like this and I’ve solved logging out from docker windows application.