dotnet / dotnet/Docker.DotNet

Docker.DotNet seems to return InternalServerError from Docker for all errors (even for 4** status codes)

Open
#266 5 comments 1 reaction 0 assignees View on GitHub
Dominant language
C#
Stars
2.4k
Forks
416
PR merge metrics
No merged PRs in 30d

Description

I have been noticing that we always get InternalServerError from the docker daemon for any kind of issues. Today, I was trying to test out a case where we should be getting unauthorized, but we still end up getting InternalServerError.

**Output of `dotnet --info`:**
PS C:\windows\system32> dotnet --info
.NET Command Line Tools (2.0.2)

Product Information:
Version: 2.0.2
Commit SHA-1 hash: a04b4bf512

Runtime Environment:
OS Name: Windows
OS Version: 10.0.14393
OS Platform: Windows
RID: win10-x64
Base Path: C:\Program Files\dotnet\sdk\2.0.2\

Microsoft .NET Core Shared Framework Host

Version : 2.0.0
Build : e8b8861ac7faf042c87a5c2f9f2d04c98b69f28d

**What version of Docker.DotNet?:**
3.125

**Steps to reproduce the issue:**
1. Try getting an image from a registry with invalid credentials.
2.
3.

Expected unauthorized but we still get InternalServerError.:
Docker.DotNet.DockerApiException: Docker API responded with status code=InternalServerError, response=
at Docker.DotNet.DockerClient.HandleIfErrorResponse(HttpStatusCode statusCode, String responseBody, IEnumerable`1 handlers)
at Docker.DotNet.DockerClient.d__50.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Docker.DotNet.Models.StreamUtil.d__1`1.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.GetResult()

However, Docker logs via
Get-EventLog -LogName Application -Source Docker -After (Get-Date).AddMinutes(-15) | Select Message produces

Handler for POST /v1.25/images/create returned error: unauthorized: authentication required
Attempting next endpoint for pull after error: unauthorized: authentication required
debug: Trying to pull myownrepo.azurecr.io/tanks2 from myownrepo.xcloudcr.azurecr.io v2

Looking at the code, I don't think this is a problem with Docker DotNet, but just wanted to check with the community here. It seems weird that docker would have one thing in the event log but return another. The docker API https://docs.docker.com/engine/api/v1.25/#operation/ImageCreate says we should get 4** status code

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.