-
Notifications
You must be signed in to change notification settings - Fork 5.3k
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
strange exit status code behavior #3379
Comments
Oh, I forgot a last result, which is interesting, as it seems that the php command behaves differently sometimes, compared to sh. % $(docker-compose exec php sh -c "exit 2;"); echo $?
2 |
Not even sure it has anything to do with moby/moby#18948 since i haven't apparmor installed AFAIK. |
The only workaround I found is to wrap it in
|
@docteurklein I have exactly the same issue... did you fixed that since? I experiment that on docker and it seems to also depend on the docker version I use. Eg releases > 1.10.3 are broken and will return a 129 exit code. |
@shouze the only workaround I found is to wrap it in sh -c, as stated above. |
Been running into this as well on 1.11.2: Works sometimes, or randomly exists with 129:
Works all the time:
|
but if I remove the allocation of the pseudo-TTY (-t parameter), it does work:
I think it's a better workaround for the issue than running sh -c, and hopefully brings some enlightenment to docker developers about the issue. |
I'm confirming |
I was running a PHP script with |
sure, but tty allocation brings colors to the output usually (that's what is used to detect if ran interactively or not.) |
I found a workaround that addresses the issue without switching to Add Example with docker
The same applies to docker-compose
Credits: docksal/docksal@34d1bb0 |
Possibly related: I am getting an exit code of 129 even when all goes well: for example:
This happens only when I call these from a script, not directly. I am using the latest version of Docker and Docker compose for Mac OS X. |
@alberto56 yes, if you read the thread you will find that myovchev already provided a solution for docker-compose #3379 (comment) |
The makefile returns an error because of the docker exec command. Similar errors at docker/compose#3379
For what it is worth I worked around the
Not pretty but it worked. I'll try setting |
# (exit \$?) is a hack to return correct exit codes when docker exec is run with tty (-t) docker/compose#3379
I don't think this is a docker-compose problemo directly:
|
I also think it's not related to docker-compose at all. (IDK why I opened this issue here). My guess is that it's related to the runtime executor directly, possibly related to the default apparmor profile. |
Hi everyone, Please note that With that in mind, I don't believe this is a Compose issue (please correct me if I'm mistaken there), and I would recommend opening an issue on the moby/moby tracker instead. |
For fresh applications, docker may exit with 129 code instead of 0. Issue found on: Docker version 17.03.2-ce, build f5ec1e2 (linux). Related: docker/compose#3379
This is still hapenning to me :( |
|
Depending wether I use
docker-compose run
with or without--rm
, the exit status code is ignored.Using
docker-compose exec
returns me a exit status code 129, while the same command withdocker exec
returns the correct status code.I tried to understand what's happening under the hood, but I can't make sense of it, so I'll paste my results here.
As you can see, there are quite a few differences :)
Is it a normal behavior?
What command should I use if I care about the exit status code?
PS: I'd like to be able to use the docker-compose exec version.
PPS: my versions:
The text was updated successfully, but these errors were encountered: