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

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 10.0sailed to do request: Head dial tcp: lookup mcr.microsoft.com on 192.168.65.5:53: => [internal] load metadata for 0.0s ------ > [internal] load metadata for ------ 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 AS base WORKDIR /app EXPOSE 80 EXPOSE 443 FROM 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?

33 Answers

1 2

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

13

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

12

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.

4

mcr.microsoft.com is down at the moment

I'm receiving several different errors when pulling:

% docker pull Error response from daemon: Get Service Unavailable % docker pull 5.0: Pulling from dotnet/sdk received unexpected HTTP status: 500 Internal Server Error 
3

What worked for me on Mac OS X was editing the Docker Config:

sudo vi ~/.docker/config.json 

Changing

"credsStore": "desktop"

to

"credStore": "desktop" 

And running, in my case:

sudo docker build -t php-demo . 

( to build the demo/sample app )

3

Could it be that, it's 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 
1

In my case the problem arose because I have Apple Silicon in my laptop, and there is no version of the image I want that is compiled for linux/arm64/v8.

To see if this is your issue, try docker pull <image> for more detailed error messages.

1

For me the problem was in the General settings.

uncheck Use Docker Compose V2 and click Apply & Restart

2

I was facing this issue while building docker container as:

Error:

 [internal] load metadata for ------ failed to solve with frontend dockerfile.v0: failed to create LLB definition: rpc error: code = Unknown desc = error getting credentials - err: exit status 1, out: `` Applications failed at ./run:build line 18. 

Solution:

I went to Docker desktop-->settings-->Docker engine--> changed "buildkit": true to "buildkit": false

{ "builder": { "gc": { "defaultKeepStorage": "20GB", "enabled": true } }, "experimental": false, "features": { "buildkit": false } } 

Now Apply and restart docker and build the application.

Once application build successfully, revert back the changes of docker engine "buildkit": false to "buildkit": true

{ "builder": { "gc": { "defaultKeepStorage": "20GB", "enabled": true } }, "experimental": false, "features": { "buildkit": true } } 

and rebuild application

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.

1

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

I had this error pop up recently and I tried changing nameservers etc. Finally restarting docker helped. sudo systemctl restart docker

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

0

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

For me it was because I was using docker-credential-helpers in ~/.docker/config.json.

{ "auths": { "ghcr.io": {}, "": {}, "registry-intl.eu-central-1.aliyuncs.com": {} }, "credsStore": "pass" } 

So I needed to unlock the keystore, for example with the following command for index.docker.io:

pass show docker-credential-helpers/aHR0cHM6Ly9pbmRleC5kb2NrZXIuaW8vdjEv/USERNAME 

In my case it was damaged .dockerignore file. Just try to delete it/rename it/recreate it.

The full error I got was:

[+] Building 2.2s (7/16) => [internal] load build definition from Dockerfile 0.0s => => transferring dockerfile: 1.31kB 0.0s => [internal] load .dockerignore 0.0s => [internal] load metadata for 0.9s => [internal] load metadata for 2.0s => [angular-built 1/8] FROM 0.0s => => resolve 0.0s => [stage-1 1/3] FROM 0.0s => => resolve 0.0s => ERROR [internal] load build context 0.0s => => transferring context: 0.0s ------ > [internal] load build context: ------ failed to solve: rpc error: code = Internal desc = stream terminated by RST_STREAM with error code: PROTOCOL_ERROR 

For me what worked is deleting the "credsStroe" from the config.json file

In my case I was using docker compose to build from a local dockerfile. Turned out I had a COPY action in my dockerfile that was using a --from=x referencing an earlier FROM where I forgot to add the AS x.

Docker-compose didn't show any of this though. It wasnt util I ran docker build that it showed me the detailed info as to why it failed.

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.

[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 

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

For me the problem was that the the token to access the registry was outdated. So make sure that docker login your-registryis working well.

Reference:

if you write code for a node like this FROM node: alpine then must need to pull

docker pull node

hopefully, it was work

2

After several weird attempts that were failing,

I just deleted the .docker folder

location: C:\Users\Name.docker

and it worked .... for me

1

Your session expired.

You have to log in again at

I had the similar error when building for multiple platforms

docker buildx build --platform linux/amd64,linux/arm64 -t name:tag . -o type=image 

I tried for single platform to update the base image (linux/amd64 then linux/arm64)

docker buildx build --platform linux/amd64 -t name:tag . -o type=image 

After done updating, I just canceled to run for both platforms and it works. In my case, there might be a bug when fetching latest base image for multiple platforms.

clearing disk space by deleting images & restarting docker did the trick for me.

I fixed it as below for windows machine,

  1. Go to your C://Users/YOUR_USER_FOLDER

  2. Get inside .docker folder

  3. Remove config.json file

  4. Using command prompt/command line/terminal, I ran docker login cmd, entered username/password and login was successful.

  5. Above command created config.json again with below contents,

    { "auths": { " }, "credsStore": "wincred" } 
  6. Just changed

    "credsStore": "wincred" 

    to

    "credStore": "desktop" 

and started working without any issue.

Two things help:

mv ~/.docker ~/.docker_broken 

Remove unused data to gain some space:

docker system prune -a 

1 2

You Might Also Like