Fix detection of hostname resolution failure (#2841)

It appears that newer version of docker outputs different error when
registry hostname is not resolvable.

Signed-off-by: Matej Vašek <mvasek@redhat.com>
This commit is contained in:
Matej Vašek 2025-05-26 21:15:17 +02:00 committed by GitHub
parent 4c4fd28c23
commit 805cb5dcc5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 3 additions and 1 deletions

View File

@ -202,7 +202,9 @@ func (n *Pusher) pushImage(ctx context.Context, f fn.Function, credentials Crede
return digest, nil
}
errStr := err.Error()
if strings.Contains(errStr, "no such host") || strings.Contains(errStr, "failure in name resolution") {
if strings.Contains(errStr, "no such host") ||
strings.Contains(errStr, "failure in name resolution") ||
regexp.MustCompile(`lookup .*: server misbehaving`).MatchString(errStr) {
// push with custom transport to be able to push into cluster private registries
return n.push(ctx, f, credentials, output)
}