3

I was trying to build a new image for a small dotnet core 3.1 console application. I got an error:

failed to solve with frontend dockerfile.v0: failed to create LLB definition: failed to copy: httpReadSeeker: failed open: failed to do request: Get https://westeurope.data.mcr.microsoft.com/42012bb2682a4d76ba7fa17a9d9a9162-qb2vm9uiex//docker/registry/v2/blobs/sha256/87/87413803399bebbe093cfb4ef6c89d426c13a62811d7501d462f2f0e018321bb/data?P1=1627480321&P2=1&P3=1&P4=uDGSoX8YSljKnDQVR6fqniuqK8fjkRvyngwKxM7ljlM%3D&se=2021-07-28T13%3A52%3A01Z&sig=wJVu%2BBQo2sldEPr5ea6KHdflARqlzPZ9Ap7uBKcEYYw%3D&sp=r&spr=https&sr=b&sv=2016-05-31&regid=42012bb2682a4d76ba7fa17a9d9a9162: x509: certificate has expired or is not yet valid

I have checked an old dotnet program which my dockerfile was working perfectly. I got the same error. Then, I jumped to Docker Hub and checked the MS Images to see that all MS images have been updated for an hour. And then they have been updated once again, 10 Minutes ago xD. However, I still cannot pull the base images of mcr.microsoft.com/dotnet/runtime:3.1 and mcr.microsoft.com/dotnet/sdk:3.1. My whole Dockerfile is:

FROM mcr.microsoft.com/dotnet/runtime:3.1 AS base
WORKDIR /app

FROM mcr.microsoft.com/dotnet/sdk:3.1 AS build
WORKDIR /src
COPY ["Kafka-dotnet-consumer/Kafka-dotnet-consumer.csproj", "Kafka-dotnet-consumer/"]
RUN dotnet restore "Kafka-dotnet-consumer/Kafka-dotnet-consumer.csproj"
COPY . .
WORKDIR "/src/Kafka-dotnet-consumer"
RUN dotnet build "Kafka-dotnet-consumer.csproj" -c Release -o /app/build

FROM build AS publish
RUN dotnet publish "Kafka-dotnet-consumer.csproj" -c Release -o /app/publish

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

and the complete error log is:

Severity    Code    Description Project File    Line    Suppression State
Error   CTC1014 Docker command failed with exit code 1.
#1 [internal] load build definition from Dockerfile
#1 sha256:356bc2781f52b021d6dc2eefeef3212c983066d4fe3637fe7928c8165f181c52
#1 DONE 0.0s

#1 [internal] load build definition from Dockerfile
#1 sha256:356bc2781f52b021d6dc2eefeef3212c983066d4fe3637fe7928c8165f181c52
#1 transferring dockerfile: 826B done
#1 DONE 0.0s

#2 [internal] load .dockerignore
#2 sha256:158b62c61546176b0f8a68c34f4aed7fe8e5f979cc578672dacd3c07aff01eb1
#2 transferring context: 35B done
#2 DONE 0.0s

#3 [internal] load metadata for mcr.microsoft.com/dotnet/sdk:3.1-alpine
#3 sha256:9c4e2456483bc5a0fda4bf0466bb996bef09b180bf33a44ede0bd988c1be9178
#3 ...

#4 [internal] load metadata for mcr.microsoft.com/dotnet/runtime:3.1-alpine
#4 sha256:46a3f71ff7a02c9ad1111e95e06323b127c541ea25dc1bca0750bc3a2ea917ca
#4 ERROR: failed to copy: httpReadSeeker: failed open: failed to do request: Get https://westeurope.data.mcr.microsoft.com/42012bb2682a4d76ba7fa17a9d9a9162-qb2vm9uiex//docker/registry/v2/blobs/sha256/87/87413803399bebbe093cfb4ef6c89d426c13a62811d7501d462f2f0e018321bb/data?P1=1627480321&P2=1&P3=1&P4=uDGSoX8YSljKnDQVR6fqniuqK8fjkRvyngwKxM7ljlM%3D&se=2021-07-28T13%3A52%3A01Z&sig=wJVu%2BBQo2sldEPr5ea6KHdflARqlzPZ9Ap7uBKcEYYw%3D&sp=r&spr=https&sr=b&sv=2016-05-31&regid=42012bb2682a4d76ba7fa17a9d9a9162: x509: certificate has expired or is not yet valid

#3 [internal] load metadata for mcr.microsoft.com/dotnet/sdk:3.1-alpine
#3 sha256:9c4e2456483bc5a0fda4bf0466bb996bef09b180bf33a44ede0bd988c1be9178
#3 CANCELED
------
 > [internal] load metadata for mcr.microsoft.com/dotnet/runtime:3.1-alpine:
------
failed to solve with frontend dockerfile.v0: failed to create LLB definition: failed to copy: httpReadSeeker: failed open: failed to do request: Get https://westeurope.data.mcr.microsoft.com/42012bb2682a4d76ba7fa17a9d9a9162-qb2vm9uiex//docker/registry/v2/blobs/sha256/87/87413803399bebbe093cfb4ef6c89d426c13a62811d7501d462f2f0e018321bb/data?P1=1627480321&P2=1&P3=1&P4=uDGSoX8YSljKnDQVR6fqniuqK8fjkRvyngwKxM7ljlM%3D&se=2021-07-28T13%3A52%3A01Z&sig=wJVu%2BBQo2sldEPr5ea6KHdflARqlzPZ9Ap7uBKcEYYw%3D&sp=r&spr=https&sr=b&sv=2016-05-31&regid=42012bb2682a4d76ba7fa17a9d9a9162: x509: certificate has expired or is not yet valid Kafka-dotnet-consumer   C:\Ziad\repos\vdpm-datagrid\Kafka-dotnet-consumer\Kafka-dotnet-consumer\Dockerfile  1   

Any ideas?

Ziad Salem
  • 496
  • 13
  • 34
  • Looks to be an issue with the container registry. Please file an issue at https://github.com/microsoft/containerregistry/issues. – Matt Thalman Jul 28 '21 at 15:48
  • Same issue for me https://github.com/microsoft/containerregistry/issues/74 – btbenjamin Jul 29 '21 at 08:43
  • I filled an issue as well on MS Container GitHub https://github.com/microsoft/containerregistry/issues/73. Still having no response – Ziad Salem Jul 29 '21 at 16:31
  • FWIW I hit this issue today and "fixed" it by rebooting my whole machine. (Just rebooting the docker engine wasn't enough, despite the answers at https://stackoverflow.com/questions/35289802/docker-pull-error-x509-certificate-has-expired-or-is-not-yet-valid ) – Chris Culter Jul 29 '21 at 21:59
  • 1
    you are right! I restarted my PC and it works again! Thanks, @ChrisCulter for the tip! – Ziad Salem Jul 30 '21 at 11:51

2 Answers2

2

so as @Chris Culter mentioned in a comment above, I just restarted my machine and it works again.

It is kind of strange because I already updated my Docker Desktop, restarted, and cleaned/ purged the docker data. None of those helped, just after restarting my windows it works again!

Ziad Salem
  • 496
  • 13
  • 34
-1

run docker builder prune

then build again.