emacs-pe / docker-tramp.el

TRAMP integration for docker containers
339 stars 26 forks source link

Tramp failed to connect on Windows #7

Open bbigras opened 8 years ago

bbigras commented 8 years ago

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 commented 8 years ago

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

jaccarmac commented 8 years ago

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 commented 6 years ago

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

nigelgbanks commented 6 years ago

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

dilzeem commented 5 years ago

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

fstamour commented 3 years ago

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.

LeeRuns commented 3 years ago

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 commented 3 years ago

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 commented 1 year ago

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

pdehne commented 10 months ago

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'