Fix podman agent container in v2 (#2897)

Add additional string matching to determine when container is not found
or running when invoked via podman compatibility socket

Co-authored-by: qwerty287 <80460567+qwerty287@users.noreply.github.com>
This commit is contained in:
Kaylyn Bogle 2023-12-02 11:22:23 -08:00 committed by GitHub
parent 621eed6205
commit bc95443853
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -361,8 +361,9 @@ var (
func isErrContainerNotFoundOrNotRunning(err error) bool {
// Error response from daemon: Cannot kill container: ...: No such container: ...
// Error response from daemon: Cannot kill container: ...: Container ... is not running"
// Error response from podman daemon: can only kill running containers. ... is in state exited
// Error: No such container: ...
return err != nil && (strings.Contains(err.Error(), "No such container") || strings.Contains(err.Error(), "is not running"))
return err != nil && (strings.Contains(err.Error(), "No such container") || strings.Contains(err.Error(), "is not running") || strings.Contains(err.Error(), "can only kill running containers"))
}
// normalizeArchType converts the arch type reported by docker info into