microsoft / Docker-PowerShell

PowerShell Module for Docker
MIT License
289 stars 87 forks source link

cannot attach to conatiner in remoting session #161

Closed rs38 closed 8 years ago

rs38 commented 8 years ago

Get-Container | Attach-Container

Attach-Container : The handle is invalid. (Exception from HRESULT: 0x80070006 (E_HANDLE))

same with Enter-ContainerSession

reproduce: PS remote to nanoserver VM, run detached container, try to enter with commands above.

when doing the same with docker attach, I get an error that TTY is not supported.

I was told by @PatrickLang in the MSDN Container Docs Repo that it should work with Docker PS

swernli commented 8 years ago

The fact that docker also doesn't work points to the real problem: PS Remoting sessions do not have the right support for terminal emulation, which is needed for setting up the pipe connections that would allow for this to work. There is also a bug in our docker powershell at the moment (https://github.com/Microsoft/Docker-PowerShell/issues/120) that prevents interactivity from working correctly with named pipes, which is the default set up of the docker daemon.

Your best bet to get interactivity to a container that is running on nano is to set up your docker daemon to accept remote connections and connect directly to that (using either docker cli or these cmdlets) instead of trying to start an interactive session within powershell remoting. You can use the instructions found here: https://docs.docker.com/engine/security/https/ to secure your docker daemon using self-signed certificates. Support for this is being added to the powershell cmdlets as part of https://github.com/Microsoft/Docker-PowerShell/pull/160, which should be in master later today.

swernli commented 8 years ago

If this doesn't answer your question, please feel free to reopen this issue to follow up.