Skip to content

docker ssh with OpenSSH-Win32 does not work with Powershell and CMD login shell #1376

@nunix

Description

@nunix

Description
When trying to connect with docker -H ssh://<host> to a Windows host running OpenSSH-Win32, if the login shell is PowerShell or CMD, the client cannot connect to the daemon.
However, if the login shell is bash (WSL), then the client can connect to the daemon.

Complete examples with the 2 scenarios
image

Steps to reproduce the issue:

  1. Set registry key HKLM:\SOFTWARE\OpenSSH\DefaultShell to C:\WINDOWS\System32\WindowsPowerShell\v1.0\powershell.exe
    image

  2. Try to connect > we get an error

docker -H ssh://localhost version
nunix@localhost's password:
nunix@localhost's password:
Client: Docker Engine - Community
 Version:           18.09.0-ce-beta1
 API version:       1.39
 Go version:        go1.10.4
 Git commit:        78a6bdb
 Built:             Thu Sep  6 22:42:13 2018
 OS/Arch:           windows/amd64
 Experimental:      false
error during connect: Get http://docker/v1.39/version: command [ssh localhost -- docker system dial-stdio] has exited with exit status 1, please make sure the URL is valid, and Docker 18.09 or later is installed on the remote host: stderr="the raw stream connection does not implement halfCloser\n"

image

  1. Set registry key HKLM:\SOFTWARE\OpenSSH\DefaultShell to C:\WINDOWS\System32\bash.exe
    image

  2. [Optional] if not running, start the npiperelay.exe from the WSL shell

sudo docker-relay &
  1. Try to connect > we succeed
docker -H ssh://localhost version
nunix@localhost's password:
Client: Docker Engine - Community
 Version:           18.09.0-ce-beta1
 API version:       1.39
 Go version:        go1.10.4
 Git commit:        78a6bdb
 Built:             Thu Sep  6 22:42:13 2018
 OS/Arch:           windows/amd64
 Experimental:      false

Server: Docker Engine - Community
 Engine:
  Version:          18.09.0-ce-beta1
  API version:      1.39 (minimum version 1.24)
  Go version:       go1.10.3
  Git commit:       78a6bdb
  Built:            Thu Sep  6 22:57:45 2018
  OS/Arch:          windows/amd64
  Experimental:     true

image

Describe the results you received:
When using Powershell or CMD as the ssh login shell, it tries to connect twice (it's not a wrong password) and then it generates an error when trying to connect to the daemon.

Describe the results you expected:
While using Powershell or CMD as the ssh login shell, it should not request twice the password and directly connect to the daemon.
In fewer words, the same behavior as for the bash login shell

Additional information you deem important (e.g. issue happens only occasionally):
When trying to connect with the WSL client, there's an additional information
image

Output of docker version:

PS C:\WINDOWS\system32> docker version
Client: Docker Engine - Community
 Version:           18.09.0-ce-beta1
 API version:       1.39
 Go version:        go1.10.4
 Git commit:        78a6bdb
 Built:             Thu Sep  6 22:42:13 2018
 OS/Arch:           windows/amd64
 Experimental:      false

Server: Docker Engine - Community
 Engine:
  Version:          18.09.0-ce-beta1
  API version:      1.39 (minimum version 1.24)
  Go version:       go1.10.3
  Git commit:       78a6bdb
  Built:            Thu Sep  6 22:57:45 2018
  OS/Arch:          windows/amd64
  Experimental:     true

Output of docker info:

PS C:\WINDOWS\system32> docker info
Containers: 0
 Running: 0
 Paused: 0
 Stopped: 0
Images: 2
Server Version: 18.09.0-ce-beta1
Storage Driver: windowsfilter (windows) lcow (linux)
 Windows:
 LCOW:
Logging Driver: json-file
Plugins:
 Volume: local
 Network: ics l2bridge l2tunnel nat null overlay transparent
 Log: awslogs etwlogs fluentd gelf json-file local logentries splunk syslog
Swarm: inactive
Default Isolation: hyperv
Kernel Version: 10.0 17754 (17754.1.amd64fre.rs5_release.180831-1429)
Operating System: Windows 10 Enterprise Version 1809 (OS Build 17754.1)
OSType: windows
Architecture: x86_64
CPUs: 4
Total Memory: 7.409GiB
Name: hpnix
ID: 3EN3:ZEK2:J34Z:G67X:HO33:VXOV:IN5E:I67M:4BSZ:YAO5:MBTO:TSO3
Docker Root Dir: C:\ProgramData\Docker
Debug Mode (client): false
Debug Mode (server): true
 File Descriptors: -1
 Goroutines: 26
 System Time: 2018-09-14T20:58:21.8133065+02:00
 EventsListeners: 1
Registry: https://index.docker.io/v1/
Labels:
Experimental: true
Insecure Registries:
 127.0.0.0/8
Live Restore Enabled: false
Product License: Community Engine

Additional environment details (AWS, VirtualBox, physical, etc.):
Configuration on WSL side:

Configuration on Windows side:

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions