Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stdout with Windows 2016 host works, but fails with Windows 10 Pro host #295

Closed
peterbud opened this issue Dec 6, 2016 · 5 comments
Closed

Comments

@peterbud
Copy link

peterbud commented Dec 6, 2016

Expected behavior

Windows 2016 host and Windows 10 Pro host should behave the same way for the same container.

Actual behavior

The following dockerfile works if the host is Windows 2016 but fails if the host is Windows 10 Pro.

More general running a docker container on Windows 10 Pro host somehow cannot handle stdout properly as I see. The below mentioned MSYS2 binaries are running fine and prodcuing expected output if I run them in a container hosted on Windows Server 2016 however no stdout is visible if the docker host is Windows 10 Pro.

Information

  • dockerfile:
FROM microsoft/windowsservercore

# Make sure we're in temp for the downloads
WORKDIR c:/windows/temp

# Switch to PowerShell
SHELL ["powershell", "-command"] 

RUN Invoke-WebRequest -UserAgent 'DockerCI' -outfile 7zsetup.exe http://www.7-zip.org/a/7z1604-x64.exe
RUN Invoke-WebRequest -UserAgent 'DockerCI' -outfile msys2-x86_64-latest.tar.xz http://repo.msys2.org/distrib/msys2-x86_64-latest.tar.xz 


RUN Start-Process .\7zsetup -ArgumentList '/S /D=c:/7zip' -Wait
RUN C:\7zip\7z e msys2-x86_64-latest.tar.xz -Wait
RUN C:\7zip\7z x msys2-x86_64-latest.tar -o"C:\\" 
RUN del *

RUN [Environment]::SetEnvironmentVariable('Path', 'C:\\msys64\\usr\\bin;' + $env:Path, [EnvironmentVariableTarget]::Machine)
ENV MSYSTEM MSYS2

RUN C:\msys64\usr\bin\pacman.exe --help

CMD powershell
  • host distribution and version (Windows version, build number, etc)
C:\WINDOWS\system32>docker version
Client:
 Version:      1.13.0-rc2
 API version:  1.25
 Go version:   go1.7.3
 Git commit:   1f9b3ef
 Built:        Wed Nov 23 17:40:58 2016
 OS/Arch:      windows/amd64

Server:
 Version:             1.13.0-rc2
 API version:         1.25
 Minimum API version: 1.24
 Go version:          go1.7.3
 Git commit:          1f9b3ef
 Built:               Wed Nov 23 17:40:58 2016
 OS/Arch:             windows/amd64
 Experimental:        false

  • windowsservercore image version:
docker run microsoft/windowsservercore powershell -command '$(gp ''HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion'').BuildLabEx'
14393.447.amd64fre.rs1_release_inmarket.161102-0100

Steps to reproduce the behavior

  1. Install docker on Windows 10 Pro host
  2. Copy the dockerfile from above
  3. docker build --rm -t msys2 .
  4. Error message:
Step 12/13 : RUN C:\msys64\usr\bin\pacman.exe --help
 ---> Running in 49fb18eb2940
The command 'powershell -command C:\msys64\usr\bin\pacman.exe --help' returned a non-zero code: 1

Do the same on Windows 2016 host:

  1. Install docker on Windows 2016 host
  2. Copy the dockerfile from above
  3. docker build --rm -t msys2 .
  4. No error message:
Step 12/13 : RUN C:\msys64\usr\bin\pacman.exe --help
 ---> Running in e217ee4cca3f
usage:  pacman <operation> [...]
operations:
    pacman {-h --help}
    pacman {-V --version}
    pacman {-D --database} <options> <package(s)>
    pacman {-F --files}    [options] [package(s)]
    pacman {-Q --query}    [options] [package(s)]
    pacman {-R --remove}   [options] <package(s)>
    pacman {-S --sync}     [options] [package(s)]
    pacman {-T --deptest}  [options] [package(s)]
    pacman {-U --upgrade}  [options] <file(s)>

use 'pacman {-h --help}' with an operation for available options
@peterbud
Copy link
Author

peterbud commented Dec 8, 2016

One additional comment:

  • I have tested the same dockerfile using a Windows 10 Pro host and a nanoserver base image (FROM microsoft/nanoserver see full dockerfile attached below): stdout is NOT working
  • I have tested the same dockerfile using a nanoserver host: it is also broken in the same way like the Windows 10 Pro host.

So in my understanding only the Windows Server 2016 host works well

msys2dockerfile.zip

@rn
Copy link
Contributor

rn commented Dec 30, 2016

@peterbud thanks for the detailed report. It looks like this is a duplicate of #262 which seems to have more details. Are you OK with closing this in favour or #262?

@peterbud
Copy link
Author

@rneugeba OK, lets close this, and use the #262 to track the issue

@stianlagstad
Copy link

stianlagstad commented Feb 1, 2019

I think I'm experiencing this issue.

  • I'm creating a docker image using microsoft/dotnet-framework:4.7.2-sdk.
  • The entrypoint is ENTRYPOINT ".\my-executable.exe".
  • When I start the container with docker run -it my-image I don't see any output from my executable.
  • When I run it directly on my system I see the expected output.
  • The executable was created with msbuild my-project.csproj /t:rebuild /p:Configuration=Release /p:PlatformTarget=x64.
  • My program has nothing to do with MSYS as far as I can tell.
  • If I instead go into a container with docker run -it --entrypoint "powershell" my-image, and then execute .\my-executable.exe while inside the container, I do see the expected output there (inside the container).

Is there something specific I have to do to make sure the output of my executable is actually output to the user running docker run -it my-image?

Edit: Adding information about my machine.

The laptop:
capture

Versions:

λ  msbuild --version
Microsoft (R) Build Engine version 15.9.21+g9802d43bc3 for .NET Framework
λ  docker --version
Docker version 18.09.1, build 4c52b90

@docker-robott
Copy link
Collaborator

Closed issues are locked after 30 days of inactivity.
This helps our team focus on active issues.

If you have found a problem that seems similar to this, please open a new issue.

Send feedback to Docker Community Slack channels #docker-for-mac or #docker-for-windows.
/lifecycle locked

@docker docker locked and limited conversation to collaborators Jun 19, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

5 participants