diff --git a/pkg/api/handlers/compat/containers_create.go b/pkg/api/handlers/compat/containers_create.go index 77e469ddfb..5fe7c06a6d 100644 --- a/pkg/api/handlers/compat/containers_create.go +++ b/pkg/api/handlers/compat/containers_create.go @@ -207,6 +207,12 @@ func cliOpts(cc handlers.CreateContainerConfig, rtc *config.Config) (*entities.C jsonString := string(b) entrypoint = &jsonString } + } else if cc.Config.Entrypoint != nil { + // Entrypoint in HTTP request is set, but it is an empty slice. + // Set the entrypoint to empty string slice, because keeping it set to nil + // would later fallback to default entrypoint. + emptySlice := "[]" + entrypoint = &emptySlice } // expose ports diff --git a/test/apiv2/20-containers.at b/test/apiv2/20-containers.at index 3dce2367b5..7ff2c2d7ea 100644 --- a/test/apiv2/20-containers.at +++ b/test/apiv2/20-containers.at @@ -782,6 +782,26 @@ if root && test -e /dev/nullb0; then podman rm -f updateCtr fi +# test apiv2 create container with empty entrypoint +# --data '{"Image":"quay.io/libpod/some:thing","Entrypoint": []}' +# Fixes #26078 +podman image build -t test1:latest -<