summaryrefslogtreecommitdiff
path: root/pkg/api/handlers/compat/containers_create.go
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2020-07-16 17:14:50 -0400
committerGitHub <noreply@github.com>2020-07-16 17:14:50 -0400
commit8c59e3f6e87b1c02760427897ab482fed33be0eb (patch)
treeb0262bea4de1a2810e0c1e89ecf8ab8df11ba1c6 /pkg/api/handlers/compat/containers_create.go
parentf4766e01e3b314543d131577d0ef891670b81a84 (diff)
parentfc81d2aceab886558e421187f7a394dea83ac5c4 (diff)
downloadpodman-8c59e3f6e87b1c02760427897ab482fed33be0eb.tar.gz
podman-8c59e3f6e87b1c02760427897ab482fed33be0eb.tar.bz2
podman-8c59e3f6e87b1c02760427897ab482fed33be0eb.zip
Merge pull request #7003 from mheon/404_on_noimage
The compat create endpoint should 404 on no such image
Diffstat (limited to 'pkg/api/handlers/compat/containers_create.go')
-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
}