mirror of
https://github.com/containers/podman.git
synced 2025-07-15 03:02:52 +08:00
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:
@ -37,6 +37,9 @@ func CreateContainer(w http.ResponseWriter, r *http.Request) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Override the container name in the body struct
|
||||||
|
body.Name = query.Name
|
||||||
|
|
||||||
if len(body.HostConfig.Links) > 0 {
|
if len(body.HostConfig.Links) > 0 {
|
||||||
utils.Error(w, utils.ErrLinkNotSupport.Error(), http.StatusBadRequest, errors.Wrapf(utils.ErrLinkNotSupport, "bad parameter"))
|
utils.Error(w, utils.ErrLinkNotSupport.Error(), http.StatusBadRequest, errors.Wrapf(utils.ErrLinkNotSupport, "bad parameter"))
|
||||||
return
|
return
|
||||||
@ -69,9 +72,6 @@ func CreateContainer(w http.ResponseWriter, r *http.Request) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// Override the container name in the body struct
|
|
||||||
body.Name = query.Name
|
|
||||||
|
|
||||||
ic := abi.ContainerEngine{Libpod: runtime}
|
ic := abi.ContainerEngine{Libpod: runtime}
|
||||||
report, err := ic.ContainerCreate(r.Context(), sg)
|
report, err := ic.ContainerCreate(r.Context(), sg)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -181,7 +181,7 @@ class TestApi(unittest.TestCase):
|
|||||||
self.assertEqual(net_default.status_code, 201, net_default.text)
|
self.assertEqual(net_default.status_code, 201, net_default.text)
|
||||||
|
|
||||||
create = requests.post(
|
create = requests.post(
|
||||||
PODMAN_URL + "/v1.40/containers/create?name=postCreate",
|
PODMAN_URL + "/v1.40/containers/create?name=postCreateConnect",
|
||||||
json={
|
json={
|
||||||
"Cmd": ["top"],
|
"Cmd": ["top"],
|
||||||
"Image": "alpine:latest",
|
"Image": "alpine:latest",
|
||||||
|
Reference in New Issue
Block a user