I had this same problem but solved it another way. psql requires that less is available on the system, and my Docker container did not have it. I simply ran apt update && apt install less and then psql worked properly.
psql
less
apt update && apt install less