相关文章推荐
热情的橡皮擦  ·  Github有趣项目 - 知乎·  1 年前    · 
安静的课本  ·  Python90-4 ...·  1 年前    · 
谈吐大方的硬盘  ·  BSTR和WCHAR* ...·  2 年前    · 
阳光的脆皮肠  ·  数据库设计 - ...·  2 年前    · 
Collectives™ on Stack Overflow

Find centralized, trusted content and collaborate around the technologies you use most.

Learn more about Collectives

Teams

Q&A for work

Connect and share knowledge within a single location that is structured and easy to search.

Learn more about Teams

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?

    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

    This worked for me; I experienced a problem shortly after moving from docker-compose to docker compose` (V2) so I guess there was an incompatible entry in the config – thclark Aug 18, 2022 at 9:43 it worked for me. but days later it happened again. my ~/.docker/config.json contained only the context I'm using. it looks clearly related with Docker Compose v2 in my case. this time I ended up removing the entire folder ~/.docker/ – logoff Oct 21, 2022 at 10:44

    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

    Thank you!! I'm starting to hate Surfshark. It starts automatically and has been creating problems for me. – GabrielP Feb 19 at 20:09 connecting to my personal wifi network by disconnecting from corporate Wifi/LAN helped me – Bhanu Chander Mar 20 at 13:08

    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
                    For me it was DNS as well - nslookup returned three A records for internal.company.repository, testing with netcat only one of the addresses actually worked... Thanks, Mordac...
    – afarah
                    Jul 19, 2022 at 15:42
    

    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

    Adding on to this, if you try pulling the image directly, you will get the architecture error if that is indeed the problem: docker pull docker.io/company/image:latest no matching manifest for linux/arm64/v8 in the manifest list entries – Carter Jan 23 at 17:35

    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.

    so weird, I ran the above docker pull ... and afterward the error then resolved itself and I could do the build like normal – Marc Dec 19, 2022 at 21:17

    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.

    This fixed it for me. I use access tokens for Docker Hub and logging in again made the error go away. – trapper_hag Jul 22, 2022 at 16:49

    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.

    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.

    I was facing this issue while building docker container as:

    Error:

     [internal] load metadata for docker.io/library/node:lts-gallium:
    ------
    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

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

    "auths": { "ghcr.io": {}, "https://index.docker.io/v1/": {}, "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
    

    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
    

    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: https://github.com/docker/buildx/issues/476#issuecomment-761875948

    Your answer could be improved with additional supporting information. Please edit to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers in the help center. – Community Dec 2, 2022 at 5:20

    After several weird attempts that were failing,

    I just deleted the .docker folder

    location: C:\Users\Name.docker

    and it worked .... for me

    Your answer could be improved with additional supporting information. Please edit to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers in the help center. – Community Dec 9, 2022 at 2:58

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

    sudo vi  ~/.docker/config.json
    

    Changing

    "credsStore": "desktop"

    "credStore": "desktop"
    

    And running, in my case:

    sudo docker build -t php-demo .
    

    ( to build the demo/sample app )

    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.

    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 docker.io/library/nginx:alpine                                                                                                                                                                    0.9s 
     => [internal] load metadata for docker.io/library/node:16.19.1-bullseye-slim                                                                                                                                                      2.0s 
     => [angular-built 1/8] FROM docker.io/library/node:16.19.1-bullseye-slim@sha256:15ea844ec458ab40d10cd469352b86d82e16c3919fd1660bbfbec565fb6853a5                                                                                  0.0s 
     => => resolve docker.io/library/node:16.19.1-bullseye-slim@sha256:15ea844ec458ab40d10cd469352b86d82e16c3919fd1660bbfbec565fb6853a5                                                                                                0.0s 
     => [stage-1 1/3] FROM docker.io/library/nginx:alpine@sha256:6318314189b40e73145a48060bff4783a116c34cc7241532d0d94198fb2c9629                                                                                                      0.0s 
     => => resolve docker.io/library/nginx:alpine@sha256:6318314189b40e73145a48060bff4783a116c34cc7241532d0d94198fb2c9629                                                                                                              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