I'm only casually familiar with Docker, and how TTYs work in Linux. At work, I use commands like docker compose up to start the development stack (Postgres + Django), and docker compose exec web python manage.py ... to run Django commands during development.
Conflicting problems:
I can't pipe in input or grep output without adding
-T. I don't know why, I just know it works with it, and not without it.- I populate the DB with
docker compose exec -T db psql -U username myproj < snapshot.sqlbecause without the-Tthe input doesn't make it to psql. - I also add
-Twhen I have to grep the output, like:
docker compose exec web python manage.py showmigrations | grep '[ ]'.
- I populate the DB with
However, when I use
-T, it screws up ANSI coloring and formatting.
Question: What's the correct method? How do I properly connect STDIN & STDOUT without messing up color & formatting?

