for-win
                                
                                 for-win copied to clipboard
                                
                                    for-win copied to clipboard
                            
                            
                            
                        failed to get console mode for stdin: The handle is invalid.
When I switch to Linux (WSL 2) containers, executing the following PowerShell script fails:
@"                                                                            
FROM busybox       
RUN echo Test      
"@ | docker build -
failed to get console mode for stdin: The handle is invalid.
[+] Building 4.5s (6/6) FINISHED
=> [internal] load build definition from Dockerfile                                                                                                                                                                                                             0.1s 
 => => transferring dockerfile: 65B                                                                                                                                                                                                                              0.1s 
 => [internal] load .dockerignore                                                                                                                                                                                                                                0.0s 
 => => transferring context: 2B                                                                                                                                                                                                                                  0.0s 
 => [internal] load metadata for docker.io/library/busybox:latest                                                                                                                                                                                                2.7s 
 => [1/2] FROM docker.io/library/busybox@sha256:b5fc1d7b2e4ea86a06b0cf88de915a2c43a99a00b6b3c0af731e5f4c07ae8eff                                                                                                                                                 0.8s 
 => => resolve docker.io/library/busybox@sha256:b5fc1d7b2e4ea86a06b0cf88de915a2c43a99a00b6b3c0af731e5f4c07ae8eff                                                                                                                                                 0.0s 
 => => sha256:b5fc1d7b2e4ea86a06b0cf88de915a2c43a99a00b6b3c0af731e5f4c07ae8eff 2.08kB / 2.08kB                                                                                                                                                                   0.0s 
 => => sha256:f3cfc9d0dbf931d3db4685ec659b7ac68e2a578219da4aae65427886e649b06b 527B / 527B                                                                                                                                                                       0.0s 
 => => sha256:d3cd072556c21c1f1940bd536675b97d7d419a2287d6bb3bd5044ea7466db788 1.46kB / 1.46kB                                                                                                                                                                   0.0s 
 => => sha256:92f8b3f0730fef84ba9825b3af6ad90de454c4c77cde732208cf84ff7dd41208 766.64kB / 766.64kB                                                                                                                                                               0.5s 
 => => extracting sha256:92f8b3f0730fef84ba9825b3af6ad90de454c4c77cde732208cf84ff7dd41208                                                                                                                                                                        0.2s 
 => [2/2] RUN echo Test                                                                                                                                                                                                                                          0.5s 
 => exporting to image                                                                                                                                                                                                                                           0.1s
 => => exporting layers                                                                                                                                                                                                                                          0.0s 
 => => writing image sha256:ab70f4f51e72e132bce917aed7a2134552e6182de191b61d181feb2f1ed3a8a5
- [X] I have tried with the latest version of Docker Desktop
- [X] I have tried disabling enabled experimental features
- [X] I have uploaded Diagnostics
- Diagnostics ID: F9C61679-70F2-4888-B1A0-BB9182F5AFBD/20210518101557
Information
- Windows Version: Windows 10x64, v20H2
- Docker Desktop Version:
Client:
 Cloud integration: 1.0.14
 Version:           20.10.6
 API version:       1.41
 Go version:        go1.16.3
 Git commit:        370c289
 Built:             Fri Apr  9 22:49:36 2021
 OS/Arch:           windows/amd64
 Context:           default
 Experimental:      true
Server: Docker Engine - Community
 Engine:
  Version:          20.10.6
  API version:      1.41 (minimum version 1.12)
  Go version:       go1.13.15
  Git commit:       8728dd2
  Built:            Fri Apr  9 22:44:56 2021
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          1.4.4
  GitCommit:        05f951a3781f4f2c1911b05e61c160e9c30eaa8e
 runc:
  Version:          1.0.0-rc93
  GitCommit:        12644e614e25b05da6fd08a38ffa0cfe1903fdec
 docker-init:
  Version:          0.19.0
  GitCommit:        de40ad0
- WSL2 or Hyper-V backend? WSL 2
- Are you running inside a virtualized Windows e.g. on a cloud server or a VM: Yes, VMware Workstation VM.
What is your concern exactly? That the container is built correctly, but PowerShell produces a spurious error message? Or is there more?
Thank you for taking the time, @stephen-turner.
It looks like the echo Test result isn't output by the build. So, I can't follow diagnostic output for checking my Dockerfile builds.
I wonder if RUN got executed at all.
Issues go stale after 90 days of inactivity.
Mark the issue as fresh with /remove-lifecycle stale comment.
Stale issues will be closed after an additional 30 days of inactivity.
Prevent issues from auto-closing with an /lifecycle frozen comment.
If this issue is safe to close now please do so.
Send feedback to Docker Community Slack channels #docker-for-mac or #docker-for-windows. /lifecycle stale
/remove-lifecycle stale /lifecycle frozen
This warning occurs on Windows 11 WSL2 in Windows Command window with Windows Docker Desktop 4.5.1 (74721). Build seems to work fine, but would be nice if warning wasn't happening. Just adding this comment since original post is old and about PowerShell and Windows 10.
docker build - < Dockerfile
failed to get console mode for stdin: The handle is invalid.
... <build otherwise works normally>
For me it doesn't work fine. It just errors out and exits:
failed to get console mode for stdin: The handle is invalid.
failed to get console mode for stdin: The handle is invalid.
the input device is not a TTY.  If you are using mintty, try prefixing the command with 'winpty'
Yes the first line gets output twice.
I don't use winty, I don't use minty, I don't use Git-Bash. I don't even have Git installed. I use Powershell.
It just started appearing in my bash on windows too not sure what happened other than it updating to 4.27.1
It just started appearing in my bash on windows too not sure what happened other than it updating to 4.27.1
I reverted back to 4.26.1 and that "fixed" it for me.
Same issue in Git bash / Cygwin -  password-stdin stop working in v4.27.1 and display failed to get console mode for stdin: The handle is invalid.
I've tested with DD 4.27.2. It's a "log" issue only. My login is successful and I can pull images despite the failure message.
It seems that this issue has been resolved with version 4.28.0. That message disappeared for me after upgrading.
It seems that this issue has been resolved with version 4.28.0. That message disappeared for me after upgrading.
Yup, no more invalid handle messages anymore with 4.28.0