在docker container中mingw没有输出

时间:2017-06-27 07:00:58

标签: windows docker terminal containers

我显然做错了什么。或者是一个错误。无论如何,在最近的docker 17.03.1-ce上,运行各种windows容器,例如:

docker run -it microsoft/windowsservercore

并且看不到mingw和cygwin工具的输出:

C:\test>dir
 Volume in drive C has no label.
 Volume Serial Number is 0E7C-C210

 Directory of C:\test

06/27/2017  08:43 AM    <DIR>          .
06/27/2017  08:43 AM    <DIR>          ..
               0 File(s)              0 bytes
               2 Dir(s)  20,098,813,952 bytes free

C:\test>bash

C:\test>bash -c 'mkdir aa'

C:\test>ls

C:\test>dir
 Volume in drive C has no label.
 Volume Serial Number is 0E7C-C210

 Directory of C:\test

06/27/2017  08:44 AM    <DIR>          .
06/27/2017  08:44 AM    <DIR>          ..
06/27/2017  08:44 AM    <DIR>          aa
               0 File(s)              0 bytes
               3 Dir(s)  20,098,813,952 bytes free

C:\test>bash -c -v -x 'mkdir aa'

C:\test>echo %errorlevel%
1

C:\test>bash -c -v -x 'mkdir aa' 2>a.txt

C:\test>dir
 Volume in drive C has no label.
 Volume Serial Number is 0E7C-C210

 Directory of C:\test

06/27/2017  08:51 AM    <DIR>          .
06/27/2017  08:51 AM    <DIR>          ..
06/27/2017  08:51 AM                69 a.txt
06/27/2017  08:44 AM    <DIR>          aa
               1 File(s)             69 bytes
               3 Dir(s)  20,098,813,952 bytes free

C:\test>type a.txt
mkdir aa
+ mkdir aa
mkdir: cannot create directory 'aa': File exists

Docker日志似乎没有任何错误或警告。

到目前为止,我也尝试过: - 用巧克力装git - 直接从zip froom github安装git - 用chocolatey安装msys2并从那里使用bash - 安装带巧克力的cygwin并从那里使用bash - 在不同的主机和容器终端尝试相同的cmd.exe powershell.exe far.exe - 问题保持不变

相同的工具在主机上正常工作,并且它们在容器内工作,只是输出丢失。

任何暗示我可以尝试的东西?

1 个答案:

答案 0 :(得分:1)

好吧,它看起来像known issue,不知道为什么我以前找不到它。

所以,(某种)解决方法是使用不带-t标志的容器