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
I've made numerous mistakes forgetting the correct flags in scripts, especially since different flags work for docker compose exec:
docker compose exec db psql -U postgres
echo 'SELECT 1;' | docker compose exec -T db psql -U postgres
docker compose used to try to guess when to allocate a TTY, but they gave up on that because of some obscure bug: docker/compose#9035.
But a switch to enable TTY detection would be good. I'd rather have a switch to tell exec/run to guess when to allocate a TTY (in compose and base docker cli) that futz with it manually.
The text was updated successfully, but these errors were encountered:
It's a tricky one. For compose, the situation was mostly in reverse; it would always use a TTY, unless disabled; this caused issues in cases where no TTY should be used, and because of that detection was needed when it could not be used (so needed to be disabled).
Detecting "when to not" attach a TTY (in the compose case) may be slightly easier (don't attach one when piping), but I'm not sure if the "reverse" is easy to do (even more so: without it being a breaking change). There's many scenarios where docker run is used and no tty should be attached (even without piping output).
Description
Companion issue to docker/compose#10227 since their behavior should be consistent.
I believe in common cases
docker exec
anddocker run
could correctly guess when stdin is a TTY and behave accordingly.I often use
psql
in thepostgres
docker container. If I want to start an interactive terminal, I have to use-it
:If I want to pipe a command to it, I have to use
-i
:I've made numerous mistakes forgetting the correct flags in scripts, especially since different flags work for
docker compose exec
:docker compose
used to try to guess when to allocate a TTY, but they gave up on that because of some obscure bug: docker/compose#9035.But a switch to enable TTY detection would be good. I'd rather have a switch to tell
exec
/run
to guess when to allocate a TTY (in compose and base docker cli) that futz with it manually.The text was updated successfully, but these errors were encountered: