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

Forbid exec a restarting container #19722

Merged
merged 1 commit into from Jan 27, 2016

Conversation

WeiZhang555
Copy link
Contributor

Currently if we exec a restarting container, client will fail silently,
and daemon will print error that container can't be found which is not a
very meaningful prompt to user.

This commit will stop user from exec a restarting container and gives
more explicit error message.

Signed-off-by: Zhang Wei zhangwei555@huawei.com

@WeiZhang555
Copy link
Contributor Author

Before this, daemon will print error message like this when exec a restarting container:

ERRO[0270] Error running exec in container: Cannot run exec command 8e2d9ab88fd3612ce3cb0ca27dcc6559ca70d25d6f05ba2c87809869fb64fc4c in container 07d12c7894590b5785cd6f8586b0206c5974fb245148d2661577105d7fa1ae39: No active container exists with ID 07d12c7894590b5785cd6f8586b0206c5974fb245148d2661577105d7fa1ae39

and client will silently fail.

Comparing to exec a paused container:
Client:

Error response from daemon: Container 1eaf1a30d230 is paused, unpause the container before exec

After applying this fix, client print when exec a restarting container:

$ docker exec -ti 48e003b685dc sh
Error response from daemon: Container 48e003b685dc is restarting, wait the container to be running

And server will print similar error, which is more meaningful to user from my point of view.

@WeiZhang555
Copy link
Contributor Author

Integration test is so hard to write, I'll try but don't know whether I can make it.

// but the container is restarting.
ErrorCodeExecRestarting = errcode.Register(errGroup, errcode.ErrorDescriptor{
Value: "EXECRESTARTING",
Message: "Container %s is restarting, wait the container to be running",
Copy link
Contributor

Choose a reason for hiding this comment

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

wait until the container is running

@calavera
Copy link
Contributor

design looks good, the message needs an small improvement 😉

Currently if we exec a restarting container, client will fail silently,
and daemon will print error that container can't be found which is not a
very meaningful prompt to user.

This commit will stop user from exec a restarting container and gives
more explicit error message.

Signed-off-by: Zhang Wei <zhangwei555@huawei.com>
@cpuguy83
Copy link
Member

LGTM w/ @calavera's suggestion.

@WeiZhang555
Copy link
Contributor Author

@calavera @cpuguy83 Error message is updated, thank you 😆

@thaJeztah
Copy link
Member

LGTM

ping @cpuguy83 for the merge

@coolljt0725
Copy link
Contributor

LGTM

coolljt0725 added a commit that referenced this pull request Jan 27, 2016
Forbid exec a restarting container
@coolljt0725 coolljt0725 merged commit 0ae9430 into moby:master Jan 27, 2016
@coolljt0725
Copy link
Contributor

@thaJeztah I add a cherry-pick, but I'm not sure

@thaJeztah
Copy link
Member

@coolljt0725 not sure either; I don't think this is a regression. It's a small change though, so we could consider it, but @tiborvass is already cherry-picking.

I'll leave this one to @tiborvass to decide

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