You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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 with docker 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.
@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.
I'm confirming docker-compose exec -T ... is solving (exactly) the same issue. Thanks @mauricioprado00
Reacted by Salah Eddine Taouririt, Mckomo, Gil Casadevall, Ujjwal Ojha, Patrik Štrba, Denis Golubovskiy, Benjamin Lazarecki, Damian Zabawa, Will Lewis, Alejandro Tabares and 12 more
Reacted by mauricioprado00, Salah Eddine Taouririt, Denis Golubovskiy, Benjamin Lazarecki, Alexei Tenitski and Nivolk
Reacted by Benjamin Lazarecki, Alexei Tenitski and Nivolk
Reacted by Denis Golubovskiy, Benjamin Lazarecki, Alexei Tenitski, Derk Developer and Nivolk
Please note that docker-compose allocates a TTY by default for run / exec operations, whereas docker does not. As such, to obtain the equivalent behavior with compose as in docker, one should use the -T flag.
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.
Activity
docteurklein commentedon Apr 26, 2016
Oh, I forgot a last result, which is interesting, as it seems that the php command behaves differently sometimes, compared to sh.
docteurklein commentedon Apr 26, 2016
Not even sure it has anything to do with moby/moby#18948 since i haven't apparmor installed AFAIK.
docteurklein commentedon Apr 26, 2016
The only workaround I found is to wrap it in
sh -c:shouze commentedon Jun 10, 2016
@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.
docteurklein commentedon Jun 11, 2016
@shouze the only workaround I found is to wrap it in sh -c, as stated above.
lrvick commentedon Jul 13, 2016
Been running into this as well on 1.11.2:
Works sometimes, or randomly exists with 129:
Works all the time:
mauricioprado00 commentedon Sep 2, 2016
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.
myovchev commentedon Sep 2, 2016
I'm confirming
docker-compose exec -T ...is solving (exactly) the same issue. Thanks @mauricioprado00geerlingguy commentedon Sep 15, 2016
I was running a PHP script with
--ttyand getting the 129 exit code (which was causing Travis CI builds to fail since it was non-0 — see https://travis-ci.org/geerlingguy/ansible-role-php-memcached/jobs/160060263#L753). Removing--ttyfrom thedocker execcall fixed it for me, and the PHP script exit code is passed through correctly (see https://travis-ci.org/geerlingguy/ansible-role-php-memcached/jobs/160061878#L753).docteurklein commentedon Sep 15, 2016
sure, but tty allocation brings colors to the output usually (that's what is used to detect if ran interactively or not.)
lmakarov commentedon Oct 17, 2016
I found a workaround that addresses the issue without switching to
shor removing-t(either of which were not a viable option).Add
; (exit $?)at the end of a command you are trying to execute withdocker exec -it.Example with docker
The same applies to docker-compose
Credits: docksal/docksal@34d1bb0
alberto56 commentedon Nov 18, 2016
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.
#7 docker/compose#3379
1 remaining item
Fix strage exit codes with docker exec
Update Makefile
fix on hanging docker exec with tty
fixed docker-compose exit code
Updating Travis CI configuration.
luispabon commentedon Jun 20, 2017
I don't think this is a docker-compose problemo directly:
docteurklein commentedon Aug 9, 2017
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.
shin- commentedon Aug 10, 2017
Hi everyone,
Please note that
docker-composeallocates a TTY by default forrun/execoperations, whereasdockerdoes not. As such, to obtain the equivalent behavior withcomposeas indocker, one should use the-Tflag.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.
Advice from docker/compose#3379 (comment) for docker-compose php bug
Fix for not working scripts/install-prod.sh
Nottt commentedon Jun 29, 2020
This is still hapenning to me :(
Nottt commentedon Jun 29, 2020
Removing tty from exec to work around "command exited with code 129"