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>
This commit is contained in:
Milivoje Legenovic
2020-12-07 12:50:10 +01:00
parent 035d2891b7
commit 4a2498ff36
2 changed files with 4 additions and 4 deletions

View File

@ -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 {