Skip to content

Commit

Permalink
Merge pull request #8624 from mlegenovic/master
Browse files Browse the repository at this point in the history
Docker compat API - containers create ignores the name
  • Loading branch information
openshift-merge-robot authored Dec 7, 2020
2 parents dc5da90 + 4a2498f commit e6f80fa
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions pkg/api/handlers/compat/containers_create.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion test/apiv2/rest_api/test_rest_v2_0_0.py
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ def test_post_create_compat_connect(self):
self.assertEqual(net_default.status_code, 201, net_default.text)

create = requests.post(
PODMAN_URL + "/v1.40/containers/create?name=postCreate",
PODMAN_URL + "/v1.40/containers/create?name=postCreateConnect",
json={
"Cmd": ["top"],
"Image": "alpine:latest",
Expand Down

0 comments on commit e6f80fa

Please sign in to comment.