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

docker start exits with code 0 on error #1872

Closed
mkscrg opened this issue Sep 12, 2013 · 8 comments
Closed

docker start exits with code 0 on error #1872

mkscrg opened this issue Sep 12, 2013 · 8 comments
Milestone

Comments

@mkscrg
Copy link

mkscrg commented Sep 12, 2013

Scripting against docker is complicated by this:

$ sudo docker start invalidid
Error: No such container: invalidid
$ echo $?
0
@crosbymichael
Copy link
Contributor

What do you suggest as an alternative?

@mkscrg
Copy link
Author

mkscrg commented Sep 13, 2013

How about returning 1 when the command fails?

Bash (and friends) treat the exit code 0 as success and non-0 as failure. So with the current situation, this doesn't work as expected:

docker start invalidid && docker attach invalidid

The first command fails, but the second command runs anyway because the first command returned 0.

@crosbymichael
Copy link
Contributor

@mkscrg what about the error message?

@mkscrg
Copy link
Author

mkscrg commented Sep 13, 2013

The message is great! It's just the exit code that's troublesome.

@crosbymichael
Copy link
Contributor

Thanks, this will be resolved with the host integration features. I am tagging this for 0.7.

@mkscrg
Copy link
Author

mkscrg commented Sep 13, 2013

It seems that docker build also returns 0 when a build fails.

@crosbymichael
Copy link
Contributor

Yes you are correct. Docker build is a little more complex because of the stream that we return. It involves a little more refactoring to return the error code.

@flavio
Copy link
Contributor

flavio commented Oct 7, 2013

I think this issue can be closed, docker start now returns 1 when it fails.

The build command is still buggy, but there's issue #1150 which covers it.

@vieux vieux closed this as completed Oct 7, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants