summaryrefslogtreecommitdiff
path: root/pkg/api/handlers
diff options
context:
space:
mode:
authorMatthew Heon <matthew.heon@pm.me>2020-07-16 14:19:24 -0400
committerMatthew Heon <matthew.heon@pm.me>2020-07-16 14:20:39 -0400
commitfc81d2aceab886558e421187f7a394dea83ac5c4 (patch)
treeb0262bea4de1a2810e0c1e89ecf8ab8df11ba1c6 /pkg/api/handlers
parentf4766e01e3b314543d131577d0ef891670b81a84 (diff)
downloadpodman-fc81d2aceab886558e421187f7a394dea83ac5c4.tar.gz
podman-fc81d2aceab886558e421187f7a394dea83ac5c4.tar.bz2
podman-fc81d2aceab886558e421187f7a394dea83ac5c4.zip
The compat create endpoint should 404 on no such image
This matches Docker behavior, and will make the Docker frontend work with `podman system service` (Docker tries to create, then if that fails with 404 sends a request to pull the image). Fixes #6960 Signed-off-by: Matthew Heon <matthew.heon@pm.me>
Diffstat (limited to 'pkg/api/handlers')
-rw-r--r--pkg/api/handlers/compat/containers_create.go6
1 files changed, 6 insertions, 0 deletions
diff --git a/pkg/api/handlers/compat/containers_create.go b/pkg/api/handlers/compat/containers_create.go
index cbee8a8b6..4ad6aa862 100644
--- a/pkg/api/handlers/compat/containers_create.go
+++ b/pkg/api/handlers/compat/containers_create.go
@@ -9,6 +9,7 @@ import (
"github.com/containers/common/pkg/config"
"github.com/containers/libpod/v2/libpod"
+ "github.com/containers/libpod/v2/libpod/define"
image2 "github.com/containers/libpod/v2/libpod/image"
"github.com/containers/libpod/v2/pkg/api/handlers"
"github.com/containers/libpod/v2/pkg/api/handlers/utils"
@@ -45,6 +46,11 @@ func CreateContainer(w http.ResponseWriter, r *http.Request) {
}
newImage, err := runtime.ImageRuntime().NewFromLocal(input.Image)
if err != nil {
+ if errors.Cause(err) == define.ErrNoSuchImage {
+ utils.Error(w, "No such image", http.StatusNotFound, err)
+ return
+ }
+
utils.Error(w, "Something went wrong.", http.StatusInternalServerError, errors.Wrap(err, "NewFromLocal()"))
return
}