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

Tramp failed to connect on Windows #7

Open
bbigras opened this issue Nov 2, 2015 · 10 comments
Open

Tramp failed to connect on Windows #7

bbigras opened this issue Nov 2, 2015 · 10 comments

Comments

@bbigras
Copy link

bbigras commented Nov 2, 2015

Messages

Tramp: Opening connection for bbigras@flapjack using docker...
Tramp: Sending command `docker  exec -it flapjack sh && exit || exit'
Tramp: Waiting for prompts from remote shell...
Tramp failed to connect.  If this happens repeatedly, try
    `M-x tramp-cleanup-this-connection'
Tramp: Waiting for prompts from remote shell...failed
Tramp: Opening connection for bbigras@flapjack using docker...failed
Error in post-command-hook (ido-exhibit): (file-error "Tramp failed to connect.  If this happens repeatedly, try
    `M-x tramp-cleanup-this-connection'")

tramp/docker bbigras@flapjack

docker  exec -it flapjack sh && exit || exit
cannot enable tty mode on non tty input

I have sh from Git For Windows (C:\Program Files\Git\usr\bin\sh.exe).

GNU Emacs 24.5.1 (x86_64-w64-mingw32) of 2015-05-16 on KAEL

@marsam
Copy link
Contributor

marsam commented Jan 14, 2016

Sorry for the late response. Looks like is a bug in docker moby/moby#12469. I currently don't have a windows machine to test it, but if you find a fix or workaround, patches are welcome

@jaccarmac
Copy link

Also getting a similar issue with more recent issues of the packages in question, including the Docker for Windows preview. Just running Emacs from Windows gives me an error telling me that Docker can't use a non-TTY input and suggesting the use of winpty. Editing docker-tramp.el to prepend winpty to the executable name results in the error input is not a tty.

@qtheperfect
Copy link

I got this problem too with the Emacs 25.3 on windows 7.

@nigelgbanks
Copy link

I've encountered this as well, anyone have news on the issue?

@dilzeem
Copy link

dilzeem commented Aug 14, 2018

Anyone resolve this? Has anyone tired using babun-docker?

@fstamour
Copy link

fstamour commented Sep 3, 2020

I managed to make emacs call docker with winpty, but then winpty complains that stdin is not a tty. I get the same error when trying to manually run "c:\Program Files\Git\usr\bin\winpty" docker exec -it friendly_hawking sh in emacs' shell.

(setf
 ;; Login program
 (rest
  (assoc 'tramp-login-program
         (rest (assoc "docker" tramp-methods))))
 (list
  (format "\"%s\""
	  (expand-file-name (concat (file-name-directory (executable-find "git")) "../usr/bin/winpty.exe"))))
 ;; Arguments
 (rest
  (assoc 'tramp-login-args
         (rest (assoc "docker" tramp-methods))))
 `((,docker-tramp-docker-options ("docker") ("exec" "-it") ("-u" "%u") ("%h") ("sh"))))

Then I tried without winpty.

  • With -t instead of -it, emacs got struck at Waiting for prompts from remote shell....
  • With -i instead of -it, emacs got stuck right after having detected a prompt from the remote shell.

@LeeRuns
Copy link

LeeRuns commented Nov 20, 2020

I have never found a way to make the emacs shell interface with docker directly, this is a problem with emacs, and when I filled a ticket they seemed to think I was crazy. But I cannot get this to work
:(

@Trisk3lion
Copy link

Emacs shell processes on Windows only works with pipes, tty is not supported at the moment. There may be hope with the new windows console but someone have to implement support for it.

@Yousuf28
Copy link

same issue. Any one have resolved this yet or are there any workaround?

@pdehne
Copy link

pdehne commented Sep 27, 2023

Sadly it seems there is still no workaround with Emacs 29.1. I am using Windows 10 and would like to use Emacs to work in dev containers, but it's not possible because of this.

To reproduce open a command line window and start a docker container: docker run -it --rm bash.

Open another command line window and find out the name of the just started container:

$ docker container ls

CONTAINER ID   IMAGE     COMMAND                  CREATED          STATUS          PORTS     NAMES
94c0f4a982e0   bash      "docker-entrypoint.s…"   12 minutes ago   Up 12 minutes             clever_panini

Start Emacs: emacs -q.

Try to open a file or directory in the container: C-x C-f RET, /docker:clever_panini:/etc

A Tramp error window pops up showing:

docker exec -it clever_panini /bin/sh -i && exit || exit
the input device is not a TTY.  If you are using mintty, try prefixing the command with 'winpty'

This can be reproduced in the Emacs shell too: emacs -q, M-x eshell, then:

~ $ docker run -it --rm bash
the input device is not a TTY.  If you are using mintty, try prefixing the command with 'winpty'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests