Why is docker-compose failing with ERROR internal load metadata suddenly?

Viewed 70770

I've been running docker-compose build for days, many times per day, and haven't changed my DOCKERFILEs or docker-compose.yml. Suddenly an hour ago I started getting this:

Building frontdesk-api
failed to get console mode for stdout: The handle is invalid.
[+] Building 10.0s (3/4)
 => [internal] load build definition from Dockerfile                       0.0s
[+] Building 10.1s (4/4) FINISHED
 => [internal] load build definition from Dockerfile                       0.0s
 => => transferring dockerfile: 32B                                        0.0s
 => [internal] load .dockerignore                                          0.0s
 => => transferring context: 2B                                            0.0s
 => ERROR [internal] load metadata for mcr.microsoft.com/dotnet/sdk:5.0.  10.0sailed to do request: Head https://mcr.microsoft.com/v2/dotnet/sdk/manifests/5.0.201-buster-slim: dial tcp: lookup mcr.microsoft.com on 192.168.65.5:53:
 => [internal] load metadata for mcr.microsoft.com/dotnet/aspnet:5.0-bust  0.0s
------
 > [internal] load metadata for mcr.microsoft.com/dotnet/sdk:5.0.201-buster-slim:
------
ERROR: Service 'frontdesk-api' failed to build

Things I've tried:

  • Running it again
  • docker rm -f $(docker ps -a -q)
  • docker login
  • Different SDK image

Here is the DOCKERFILE:

FROM mcr.microsoft.com/dotnet/aspnet:5.0-buster-slim AS base
WORKDIR /app
EXPOSE 80
EXPOSE 443

FROM mcr.microsoft.com/dotnet/sdk:5.0.201-buster-slim AS build
WORKDIR /app
# run this from repository root
COPY ./ ./ 
#RUN ls -lha .

RUN echo 'Building FrontDesk container'

WORKDIR /app/FrontDesk/src/FrontDesk.Api
#RUN ls -lha .
RUN dotnet restore

RUN dotnet build "FrontDesk.Api.csproj" -c Release -o /app/build

FROM build AS publish
RUN dotnet publish "FrontDesk.Api.csproj" -c Release -o /app/publish

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

How can I get my build working again?

15 Answers

the solution that worked for me is to delete the .docker/config.json by running

rm  ~/.docker/config.json 

then docker-compose up your-services should work

mcr.microsoft.com is down at the moment

I'm receiving several different errors when pulling:

% docker pull mcr.microsoft.com/dotnet/sdk:5.0
Error response from daemon: Get https://mcr.microsoft.com/v2/: Service Unavailable

% docker pull mcr.microsoft.com/dotnet/sdk:5.0
5.0: Pulling from dotnet/sdk
received unexpected HTTP status: 500 Internal Server Error

In my case, it was corporate VPN that caused this issue. Once I disabled the VPN, it worked fine. Not really a solution, I admit. You could disable the VPN for the duration of this command run and enable it back.

For linux

Step 1: sudo vi ~/.docker/config.json

You will see something like this:

    {
      "credsStore": "desktop.exe"
    }

Step 2: Update credsStore to credStore

Step 3: Run your services docker-compose up your-services

Windows:

Step 1: Go to C:\Users\Name\.docker

Step 2: Open config.json

Step 3: Update credsStore to credStore

Step 4: Run your services docker-compose up your-services

Could it be the is getting the wrong arch/platform to build the image. Try specifying one in the command:

docker build -t auth:1.0.0 --platform=linux/arm64 .

getting the current arch

arch

I think this has to do with issues trying to load the meta data of the image specified in the dockerfile from the dockerhub or the container repository of your choice. a quick fix is to check if your internet is up or you have necessary access. this is what resolve it for me.

Yeap, faced with the same issue. As guys said - looks like it is their side issue or DNS is feeling bad. Try to pull it manually using docker pull few times in a row, it may help.

Also, try to switch your internet provider from cable/wireless to gsm for example if you have the ability to do it, also working solution.

enter image description here

Happened the same to me after adding custom nameservers.

   [network]
   generateResolvConf = false 

I reverted that line on

/etc/wsl.conf

and after doing wsl.exe --shutdown on the powersell and restart again docker, it worked fine again.

I had:

ERROR [internal] load metadata for docker.io/library/python:3.7-slim

Running the exact same command again helped, I swear.

It was proxy settings for me. I had proxy enabled in docker desktop. Disabling worked for me.

[Specific solution] Only if building from a virtual environment. Try deactivating it, event if it is the base one. e.g. for conda:

conda deactivate

I DELETED THE ENTIRE "C:\Users\NAME\.docker" FOLDER AND IT WORKED.

Started getting this error out of nowhere, checked my WSL Integration and the toggle was off.

After enabling and restarting it again it started working.

enter image description here

no disk space

I just got the exact same error and in my case the problem was that I didn't have enough disk space. I'm running docker in a VM with 32 GB virtual disk and it just ran out of all the docker images. I freed up some space and the problem was solved.

Check your proxy settings. For me, this got resolved after proxy settings change

git config --global http.proxy proxy-eu.<name>.com:8080

name should be replaced

Related