summaryrefslogtreecommitdiff
path: root/pkg/api/handlers/compat/containers_create.go
diff options
context:
space:
mode:
authorMilivoje Legenovic <m.legenovic@gmail.com>2020-12-07 12:50:10 +0100
committerMilivoje Legenovic <m.legenovic@gmail.com>2020-12-07 14:28:50 +0100
commit4a2498ff36d58a4c7358b9e7f824f0c8530f3a17 (patch)
treee68eecf7dc50f1173be325a7e9c3c0999802f3c3 /pkg/api/handlers/compat/containers_create.go
parent035d2891b79d9e44aca81ee449bbe7dc7d6ebe37 (diff)
downloadpodman-4a2498ff36d58a4c7358b9e7f824f0c8530f3a17.tar.gz
podman-4a2498ff36d58a4c7358b9e7f824f0c8530f3a17.tar.bz2
podman-4a2498ff36d58a4c7358b9e7f824f0c8530f3a17.zip
Docker compat API - containers create ignores the name
/containers/create compat endpoint does not set the name correctly (#7857) Signed-off-by: Milivoje Legenovic <m.legenovic@gmail.com>
Diffstat (limited to 'pkg/api/handlers/compat/containers_create.go')
-rw-r--r--pkg/api/handlers/compat/containers_create.go6
1 files changed, 3 insertions, 3 deletions
diff --git a/pkg/api/handlers/compat/containers_create.go b/pkg/api/handlers/compat/containers_create.go
index 729639928..409a74de2 100644
--- a/pkg/api/handlers/compat/containers_create.go
+++ b/pkg/api/handlers/compat/containers_create.go
@@ -37,6 +37,9 @@ func CreateContainer(w http.ResponseWriter, r *http.Request) {
return
}
+ // Override the container name in the body struct
+ body.Name = query.Name
+
if len(body.HostConfig.Links) > 0 {
utils.Error(w, utils.ErrLinkNotSupport.Error(), http.StatusBadRequest, errors.Wrapf(utils.ErrLinkNotSupport, "bad parameter"))
return
@@ -69,9 +72,6 @@ func CreateContainer(w http.ResponseWriter, r *http.Request) {
return
}
- // Override the container name in the body struct
- body.Name = query.Name
-
ic := abi.ContainerEngine{Libpod: runtime}
report, err := ic.ContainerCreate(r.Context(), sg)
if err != nil {