白狗子的博客

「天上浮云如白衣,斯须改变如苍狗。」——杜甫

Docker-Windows-exec-TTY

2026年10月16日·Admin·1 次浏览

Windows:docker exec 提示 “the input device is not a TTY”

原因

在 Git Bash / Mintty 等终端里使用 -it 分配伪终端时,Windows 下常需通过 winpty 包装。

处理

winpty docker exec -it <容器ID或名> bash

或改用 PowerShell / Windows Terminal + WSL2 直接执行 docker exec -it ...。

若不需要交互

去掉 -t,仅用 -i 或都不用,执行单次命令:

docker exec <容器名> ls /

© 2025 My Blog. Built with Nuxt.js v4