不知道为啥就是不行,不过本来就对 docker 这玩意没啥好感。
$ docker exec -it foo /bin/bash foo@649fb21d747c:~$ stty size 0 0 foo@649fb21d747c:~$ reset -w foo@649fb21d747c:~$ stty size 24 80 foo@649fb21d747c:~$ # That was still wrong. Now resize the terminal to get a SIGWINCH. foo@649fb21d747c:~$ stty size 69 208 foo@649fb21d747c:~$ exit exit $ docker exec -it foo /bin/bash # Try it again. foo@649fb21d747c:~$ stty size 69 208 foo@649fb21d747c:~$ # Doesn't happen anymore for this session.