Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix bug which mistakes 400 error for 500 #22762

Merged
merged 1 commit into from
May 19, 2016

Conversation

coldTea214
Copy link
Contributor

When users run/create a container without specifying a command, daemon will return 500 error instead of 400 error.

For example:

Dockerfile:
From debian:jessie
CMD []

docker build -t test .
docker create/run test

Signed-off-by: Wang Xing hzwangxing@corp.netease.com

@coolljt0725
Copy link
Contributor

it's make sense to return 400 if no command specified, so LGTM

@thaJeztah
Copy link
Member

Will this be a breaking change for people using the API? Technically, it's a change in the API, so it's possible this change should be versioned, but perhaps it's not that big of a problem (so, just mentioning it).

ping @vdemeester @calavera @MHBauer wdyt?

@MHBauer
Copy link
Contributor

MHBauer commented May 16, 2016

Is this on the create or the start?

Either way I think we need an update to the docker remote api docs, https://github.com/docker/docker/blob/master/docs/reference/api/docker_remote_api_v1.24.md, as, @thaJeztah says, it is an API change.

@justincormack
Copy link
Contributor

It should be documented, but it is unlikely to break anything in practise, looks good.

@thaJeztah
Copy link
Member

Alright, let's go with documenting it; @coolljt0725 can you add this change to https://github.com/docker/docker/blob/master/docs/reference/api/docker_remote_api.md#v124-api-changes,

and to https://github.com/docker/docker/blob/master/docs/reference/api/docker_remote_api_v1.24.md. Given that we are not going to version this change, all older versions of the API docs should also be updated

@coolljt0725
Copy link
Contributor

@thaJeztah ok, will do

@thaJeztah
Copy link
Member

Oh! @coolljt0725 I actually meant to ping @wangxing1517 😊

@coolljt0725
Copy link
Contributor

@thaJeztah haha, it's ok :)
@wangxing1517 please follow the #22762 (comment), add the docs change in this PR, so we don't need a separate PR

@coldTea214
Copy link
Contributor Author

@thaJeztah , I am done with my work.

@@ -116,6 +116,7 @@ This section lists each version from latest to oldest. Each listing includes a
* `GET /info` now returns `SecurityOptions` field, showing if `apparmor`, `seccomp`, or `selinux` is supported.
* `GET /networks` now supports filtering by `label` and `driver`.
* `POST /containers/create` now takes `MaximumIOps` and `MaximumIOBps` fields. Windows daemon only.
* If no command specified when create a container, an HTTP 400 is now returned instead of a 500.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps

* `POST /containers/create` now returns a HTTP 400 "bad parameter" message
  if no command is specified (instead of a HTTP 500 "server error")

@thaJeztah
Copy link
Member

Thanks @wangxing1517! I left one suggestion, can you update that, and squash your commits? (It's ok to have just a single commit for this PR)

@GordonTheTurtle GordonTheTurtle added the dco/no Automatically set by a bot when one of the commits lacks proper signature label May 19, 2016
@thaJeztah
Copy link
Member

thaJeztah commented May 19, 2016

Oh, looks like you introduced a merge-commit in that last push; can you try doing a rebase and squash your commits? You can also find some instructions in our contributors guide; https://docs.docker.com/opensource/workflow/work-issue/#pull-and-rebase-frequently

Signed-off-by: Wang Xing <hzwangxing@corp.netease.com>
@GordonTheTurtle GordonTheTurtle removed the dco/no Automatically set by a bot when one of the commits lacks proper signature label May 19, 2016
@coldTea214
Copy link
Contributor Author

Thanks for your kind reminder.

@thaJeztah
Copy link
Member

LGTM, thanks!

ping @MHBauer @coolljt0725 PTAL

@coolljt0725
Copy link
Contributor

@wangxing1517 thank you
LGTM

@thaJeztah
Copy link
Member

hmf, WindowsTP5 is running into a flaky test; #22601. Restarting

@LK4D4
Copy link
Contributor

LK4D4 commented May 19, 2016

LGTM

@LK4D4 LK4D4 merged commit 376c15b into moby:master May 19, 2016
@coldTea214 coldTea214 deleted the fix_mistake_400_for_500 branch October 21, 2016 05:54
liusdu pushed a commit to liusdu/moby that referenced this pull request Oct 30, 2017
cherry-picked from upstream moby#22762

When users run/create a container without specifying a command, daemon
will return 500 error instead of 400 error.

For example:

Dockerfile:
From debian:jessie
CMD []

docker build -t test .
docker create/run test

Signed-off-by: Wang Xing hzwangxing@corp.netease.com

Signed-off-by: xiekeyang <xiekeyang@huawei.com>
liusdu pushed a commit to liusdu/moby that referenced this pull request Oct 30, 2017
Fix bug which mistakes 400 error for 500

cherry-picked from upstream moby#22762

When users run/create a container without specifying a command, daemon
will return 500 error instead of 400 error.

For example:

Dockerfile:
From debian:jessie
CMD []

docker build -t test .
docker create/run test

Signed-off-by: Wang Xing hzwangxing@corp.netease.com

Signed-off-by: xiekeyang <xiekeyang@huawei.com>



See merge request docker/docker!611
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants