Skip to content

"The SSL connection could not be established" when publishing despite docker login success #338

@QuantumToasted

Description

@QuantumToasted

I am attempting to publish my images to a local (LAN, not same device) registry during build via the following publish command:

dotnet publish --os linux --arch x64 -c Release /t:PublishContainer -p:ContainerImageName=linus -p:ContainerRegistry=portainer.local:32768

However, the following error occurs during building (full build output below):

Output
MSBuild version 17.4.1+9a89d02ff for .NET
  Determining projects to restore...
  Restored D:\Code\Linus\Linus.csproj (in 239 ms).
  Linus -> D:\Code\Linus\bin\Release\net7.0\linux-x64\Linus.dll
  Linus -> D:\Code\Linus\bin\Release\net7.0\linux-x64\publish\
  Building image 'linus' with tags 1.0.0 on top of base image mcr.microsoft.com/dotnet/runtime:7.0
  Uploading layer sha256:bb263680fed18eecdc67f885094df6f589bafc19004839d7fdf141df236a61aa to portainer.local
  Uploading layer sha256:dff5dc947f3862f82b1f73d4ecbd58c35db35a33631d54604377e4616759b6e9 to portainer.local
  Uploading layer sha256:753f39de0335d8570d9f310cab6547650ac744d62d1e5cbd6e716a1b9e8191c4 to portainer.local
  Uploading layer sha256:c671073c7a89f080aefc598baca97a4b232d1f597738eae7888033638a8ee31e to portainer.local
  Uploading layer sha256:ed8da48a765e595a4492b50b66824970421bb768d7744a38ab9af815fc3ca1f1 to portainer.local
C:\Users\omitted\.nuget\packages\microsoft.net.build.containers\0.3.2\build\Microsoft.NET.Build.Containers.targets(114,9): error : Failed to push to the output registry: System.AggregateException: One or more erro
rs occurred. (The SSL connection could not be established, see inner exception.) [D:\Code\Linus\Linus.csproj]
C:\Users\omitted\.nuget\packages\microsoft.net.build.containers\0.3.2\build\Microsoft.NET.Build.Containers.targets(114,9): error :  ---> System.Net.Http.HttpRequestException: The SSL connection could not be establ
ished, see inner exception. [D:\Code\Linus\Linus.csproj]
C:\Users\omitted\.nuget\packages\microsoft.net.build.containers\0.3.2\build\Microsoft.NET.Build.Containers.targets(114,9): error :  ---> System.Security.Authentication.AuthenticationException: Cannot determine the
 frame size or a corrupted frame was received. [D:\Code\Linus\Linus.csproj]
C:\Users\omitted\.nuget\packages\microsoft.net.build.containers\0.3.2\build\Microsoft.NET.Build.Containers.targets(114,9): error :    at System.Net.Security.SslStream.GetFrameSize(ReadOnlySpan`1 buffer) [D:\Code\L
inus\Linus.csproj]
C:\Users\omitted\.nuget\packages\microsoft.net.build.containers\0.3.2\build\Microsoft.NET.Build.Containers.targets(114,9): error :    at System.Net.Security.SslStream.EnsureFullTlsFrameAsync[TIOAdapter](Cancellati
onToken cancellationToken) [D:\Code\Linus\Linus.csproj]
C:\Users\omitted\.nuget\packages\microsoft.net.build.containers\0.3.2\build\Microsoft.NET.Build.Containers.targets(114,9): error :    at System.Runtime.CompilerServices.PoolingAsyncValueTaskMethodBuilder`1.StateMa
chineBox`1.System.Threading.Tasks.Sources.IValueTaskSource<TResult>.GetResult(Int16 token) [D:\Code\Linus\Linus.csproj]
C:\Users\omitted\.nuget\packages\microsoft.net.build.containers\0.3.2\build\Microsoft.NET.Build.Containers.targets(114,9): error :    at System.Net.Security.SslStream.ReceiveBlobAsync[TIOAdapter](CancellationToken
 cancellationToken) [D:\Code\Linus\Linus.csproj]
C:\Users\omitted\.nuget\packages\microsoft.net.build.containers\0.3.2\build\Microsoft.NET.Build.Containers.targets(114,9): error :    at System.Net.Security.SslStream.ForceAuthenticationAsync[TIOAdapter](Boolean r
eceiveFirst, Byte[] reAuthenticationData, CancellationToken cancellationToken) [D:\Code\Linus\Linus.csproj]
C:\Users\omitted\.nuget\packages\microsoft.net.build.containers\0.3.2\build\Microsoft.NET.Build.Containers.targets(114,9): error :    at System.Net.Http.ConnectHelper.EstablishSslConnectionAsync(SslClientAuthentic
ationOptions sslOptions, HttpRequestMessage request, Boolean async, Stream stream, CancellationToken cancellationToken) [D:\Code\Linus\Linus.csproj]
C:\Users\omitted\.nuget\packages\microsoft.net.build.containers\0.3.2\build\Microsoft.NET.Build.Containers.targets(114,9): error :    --- End of inner exception stack trace --- [D:\Code\Linus\Linus.csproj]
C:\Users\omitted\.nuget\packages\microsoft.net.build.containers\0.3.2\build\Microsoft.NET.Build.Containers.targets(114,9): error :    at System.Net.Http.ConnectHelper.EstablishSslConnectionAsync(SslClientAuthentic
ationOptions sslOptions, HttpRequestMessage request, Boolean async, Stream stream, CancellationToken cancellationToken) [D:\Code\Linus\Linus.csproj]
C:\Users\omitted\.nuget\packages\microsoft.net.build.containers\0.3.2\build\Microsoft.NET.Build.Containers.targets(114,9): error :    at System.Net.Http.HttpConnectionPool.ConnectAsync(HttpRequestMessage request,
Boolean async, CancellationToken cancellationToken) [D:\Code\Linus\Linus.csproj]
C:\Users\omitted\.nuget\packages\microsoft.net.build.containers\0.3.2\build\Microsoft.NET.Build.Containers.targets(114,9): error :    at System.Net.Http.HttpConnectionPool.CreateHttp11ConnectionAsync(HttpRequestMe
ssage request, Boolean async, CancellationToken cancellationToken) [D:\Code\Linus\Linus.csproj]
C:\Users\omitted\.nuget\packages\microsoft.net.build.containers\0.3.2\build\Microsoft.NET.Build.Containers.targets(114,9): error :    at System.Net.Http.HttpConnectionPool.AddHttp11ConnectionAsync(QueueItem queueI
tem) [D:\Code\Linus\Linus.csproj]
C:\Users\omitted\.nuget\packages\microsoft.net.build.containers\0.3.2\build\Microsoft.NET.Build.Containers.targets(114,9): error :    at System.Threading.Tasks.TaskCompletionSourceWithCancellation`1.WaitWithCancel
lationAsync(CancellationToken cancellationToken) [D:\Code\Linus\Linus.csproj]
C:\Users\omitted\.nuget\packages\microsoft.net.build.containers\0.3.2\build\Microsoft.NET.Build.Containers.targets(114,9): error :    at System.Net.Http.HttpConnectionPool.HttpConnectionWaiter`1.WaitForConnectionA
sync(Boolean async, CancellationToken requestCancellationToken) [D:\Code\Linus\Linus.csproj]
C:\Users\omitted\.nuget\packages\microsoft.net.build.containers\0.3.2\build\Microsoft.NET.Build.Containers.targets(114,9): error :    at System.Net.Http.HttpConnectionPool.SendWithVersionDetectionAndRetryAsync(Htt
pRequestMessage request, Boolean async, Boolean doRequestAuth, CancellationToken cancellationToken) [D:\Code\Linus\Linus.csproj]
C:\Users\omitted\.nuget\packages\microsoft.net.build.containers\0.3.2\build\Microsoft.NET.Build.Containers.targets(114,9): error :    at System.Net.Http.RedirectHandler.SendAsync(HttpRequestMessage request, Boolea
n async, CancellationToken cancellationToken) [D:\Code\Linus\Linus.csproj]
C:\Users\omitted\.nuget\packages\microsoft.net.build.containers\0.3.2\build\Microsoft.NET.Build.Containers.targets(114,9): error :    at Microsoft.NET.Build.Containers.AuthHandshakeMessageHandler.SendAsync(HttpReq
uestMessage request, CancellationToken cancellationToken) in D:\a\_work\1\s\Microsoft.NET.Build.Containers\AuthHandshakeMessageHandler.cs:line 173 [D:\Code\Linus\Linus.csproj]
C:\Users\omitted\.nuget\packages\microsoft.net.build.containers\0.3.2\build\Microsoft.NET.Build.Containers.targets(114,9): error :    at System.Net.Http.HttpClient.<SendAsync>g__Core|83_0(HttpRequestMessage reques
t, HttpCompletionOption completionOption, CancellationTokenSource cts, Boolean disposeCts, CancellationTokenSource pendingRequestsCts, CancellationToken originalCancellationToken) [D:\Code\Linus\Linus.csproj]
C:\Users\omitted\.nuget\packages\microsoft.net.build.containers\0.3.2\build\Microsoft.NET.Build.Containers.targets(114,9): error :    at Microsoft.NET.Build.Containers.Registry.BlobAlreadyUploaded(String name, Str
ing digest, HttpClient client) in D:\a\_work\1\s\Microsoft.NET.Build.Containers\Registry.cs:line 381 [D:\Code\Linus\Linus.csproj]
C:\Users\omitted\.nuget\packages\microsoft.net.build.containers\0.3.2\build\Microsoft.NET.Build.Containers.targets(114,9): error :    at Microsoft.NET.Build.Containers.Registry.<>c__DisplayClass40_0.<<Push>b__0>d.
MoveNext() in D:\a\_work\1\s\Microsoft.NET.Build.Containers\Registry.cs:line 431 [D:\Code\Linus\Linus.csproj]
C:\Users\omitted\.nuget\packages\microsoft.net.build.containers\0.3.2\build\Microsoft.NET.Build.Containers.targets(114,9): error : --- End of stack trace from previous location --- [D:\Code\Linus\Linus.csproj]
C:\Users\omitted\.nuget\packages\microsoft.net.build.containers\0.3.2\build\Microsoft.NET.Build.Containers.targets(114,9): error :    at Microsoft.NET.Build.Containers.Registry.Push(Image x, String name, String ta
g, String baseName, Action`1 logProgressMessage) in D:\a\_work\1\s\Microsoft.NET.Build.Containers\Registry.cs:line 460 [D:\Code\Linus\Linus.csproj]
C:\Users\omitted\.nuget\packages\microsoft.net.build.containers\0.3.2\build\Microsoft.NET.Build.Containers.targets(114,9): error :    --- End of inner exception stack trace --- [D:\Code\Linus\Linus.csproj]
C:\Users\omitted\.nuget\packages\microsoft.net.build.containers\0.3.2\build\Microsoft.NET.Build.Containers.targets(114,9): error :    at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledEx
ceptions) [D:\Code\Linus\Linus.csproj]
C:\Users\omitted\.nuget\packages\microsoft.net.build.containers\0.3.2\build\Microsoft.NET.Build.Containers.targets(114,9): error :    at System.Threading.Tasks.Task.Wait(Int32 millisecondsTimeout, CancellationToke
n cancellationToken) [D:\Code\Linus\Linus.csproj]
C:\Users\omitted\.nuget\packages\microsoft.net.build.containers\0.3.2\build\Microsoft.NET.Build.Containers.targets(114,9): error :    at System.Threading.Tasks.Task.Wait() [D:\Code\Linus\Linus.csproj]
C:\Users\omitted\.nuget\packages\microsoft.net.build.containers\0.3.2\build\Microsoft.NET.Build.Containers.targets(114,9): error :    at Microsoft.NET.Build.Containers.Tasks.CreateNewImage.Execute() in D:\a\_work\
1\s\Microsoft.NET.Build.Containers\CreateNewImage.cs:line 149 [D:\Code\Linus\Linus.csproj]

Logging into this registry via docker login on the same machine works fine, and does not change the output whether it's run before or after the failed publish. I did have to add it as an insecure registry. (However, I don't have any local images to try pushing to see if it's an issue with the registry, sorry 😢)

Is this an issue with this tool, the registry, or something else? If it perhaps could be the cause, the same local domain (portainer.local) happens to have a self-signed cert for the portainer container itself.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions