emacs-pe / docker-tramp.el

TRAMP integration for docker containers
340 stars 25 forks source link

Fails to connect to interpreter inside container #19

Closed olymk2 closed 6 years ago

olymk2 commented 6 years ago

Trying to use docker-tramp with pony to connect to an interpreter inside a container, getting close but I am seeing an error it looks like it connects but fails to connect to the interpreter command any ideas on whats wrong ? or where do i go to diagnose this issue the error just says failed and does not give any indication as to why,

;; GNU Emacs: 25.2.2 Tramp: 2.2.13.25.2 -*- mode: outline; -*-
23:27:11.273114 tramp-get-file-property (8) # /usr/local/bin/python file-directory-p undef
23:27:11.273229 tramp-get-connection-property (7) # test undef
23:27:11.273294 tramp-get-test-command (5) # Finding a suitable ‘test’ command
23:27:11.273364 tramp-get-connection-property (7) # process-name nil
23:27:11.273431 tramp-get-connection-property (7) # process-name nil
23:27:11.273495 tramp-get-connection-property (7) # process-buffer nil
23:27:11.273693 tramp-maybe-open-connection (3) # Opening connection for hackdev_django_1 using docker...
23:27:11.276418 tramp-get-local-locale (7) # locale en_US.utf8
23:27:11.276873 tramp-get-connection-property (7) # login-args undef
23:27:11.276996 tramp-get-connection-property (7) # login-args undef
23:27:11.277133 tramp-get-connection-property (7) # process-name nil
23:27:11.277227 tramp-get-connection-property (7) # process-buffer nil
23:27:11.278206 tramp-set-connection-property (7) # vector [docker nil hackdev_django_1 /usr/local/bin/python nil]
23:27:11.278313 tramp-maybe-open-connection (6) # /bin/sh -i
23:27:11.278401 tramp-get-connection-property (7) # vector [docker nil hackdev_django_1 /usr/local/bin/python nil]
23:27:11.278501 tramp-get-connection-property (7) # check-remote-echo nil
23:27:11.278552 tramp-get-connection-property (7) # check-remote-echo nil
23:27:11.278627 tramp-get-connection-property (7) # gateway nil
23:27:11.278723 tramp-get-connection-property (7) # check-remote-echo nil
23:27:11.278778 tramp-get-connection-property (7) # check-remote-echo nil
23:27:11.278835 tramp-wait-for-regexp (6) # 
#$ 
23:27:11.278903 tramp-get-connection-property (7) # login-program undef
23:27:11.278983 tramp-get-connection-property (7) # login-args undef
23:27:11.279048 tramp-get-connection-property (7) # login-env undef
23:27:11.279110 tramp-get-connection-property (7) # async-args undef
23:27:11.279171 tramp-get-connection-property (7) # connection-timeout undef
23:27:11.279236 tramp-get-connection-property (7) # gw-args undef
23:27:11.279309 tramp-get-connection-property (7) # temp-file undef
23:27:11.279415 tramp-set-connection-property (7) # temp-file /tmp/tramp.20367whh
23:27:11.280059 tramp-maybe-open-connection (3) # Sending command ‘exec docker  exec -it  hackdev_django_1 sh’
23:27:11.280166 tramp-get-connection-property (7) # process-name nil
23:27:11.280280 tramp-get-connection-property (7) # remote-echo nil
23:27:11.280366 tramp-send-command (6) # exec docker  exec -it  hackdev_django_1 sh
23:27:11.280493 tramp-get-connection-property (7) # process-name nil
23:27:11.280594 tramp-get-connection-property (7) # chunksize nil
23:27:11.280658 tramp-set-connection-property (7) # last-cmd-time (23193 56783 280636 861000)
23:27:11.280726 tramp-get-connection-property (7) # process-buffer nil
23:27:11.280896 tramp-set-connection-property (7) # first-password-request t
23:27:11.281114 tramp-process-actions (3) # Waiting for prompts from remote shell...
23:27:11.281388 tramp-get-connection-property (7) # gateway nil
23:27:11.354752 tramp-process-one-action (5) # Looking for regexp "\(.*\(user\|login\)\( .*\)?: *\)\'" from remote shell
23:27:11.354846 tramp-get-connection-property (7) # check-remote-echo nil
23:27:11.354911 tramp-get-connection-property (7) # check-remote-echo nil
23:27:11.354996 tramp-process-one-action (5) # Looking for regexp "\(^.*\(\(?:adgangskode\|contrase\(?:\(?:ny\|ñ\)a\)\|geslo\|h\(?:\(?:asł\|esl\)o\)\|iphasiwedi\|jelszó\|l\(?:ozinka\|ösenord\)\|m\(?:ot de passe\|ật khẩu\)\|pa\(?:rola\|s\(?:ahitza\|s\(?: phrase\|code\|ord\|phrase\|wor[dt]\)\|vorto\)\)\|s\(?:alasana\|enha\|laptažodis\)\|wachtwoord\|лозинка\|пароль\|ססמה\|كلمة السر\|गुप्तशब्द\|शब्दकूट\|গুপ্তশব্দ\|পাসওয়ার্ড\|ਪਾਸਵਰਡ\|પાસવર્ડ\|ପ୍ରବେଶ ସଙ୍କେତ\|கடவுச்சொல்\|సంకేతపదము\|ಗುಪ್ತಪದ\|അടയാളവാക്ക്\|රහස්පදය\|ពាក្យសម្ងាត់\|パスワード\|密[码碼]\|암호\)\).*: ? *\)\'" from remote shell
23:27:11.355091 tramp-get-connection-property (7) # check-remote-echo nil
23:27:11.355152 tramp-get-connection-property (7) # check-remote-echo nil
23:27:11.355237 tramp-process-one-action (5) # Looking for regexp "\(^.*\(Connection \(?:\(?:clo\|refu\)sed\)\|Host key verification failed\.\|Login \(?:[Ii]ncorrect\)\|N\(?:ame or service not known\|o supported authentication methods left to try!\)\|Permission denied\|\(?:Sorry, try again\|Timeout, server not responding\)\.\).*\|^.*\(Received signal [0-9]+\).*\)\'" from remote shell
23:27:11.355306 tramp-get-connection-property (7) # check-remote-echo nil
23:27:11.355375 tramp-get-connection-property (7) # check-remote-echo nil
23:27:11.355449 tramp-process-one-action (5) # Looking for regexp "\(^[^#$%>
]*[#$%>] *\)\'" from remote shell
23:27:11.355512 tramp-get-connection-property (7) # check-remote-echo nil
23:27:11.355569 tramp-get-connection-property (7) # check-remote-echo nil
23:27:11.355638 tramp-process-one-action (5) # Call ‘tramp-action-succeed’
23:27:11.355814 tramp-get-connection-property (7) # process-buffer nil
23:27:11.355881 tramp-process-actions (6) # 
$ 
23:27:11.355948 tramp-get-connection-property (7) # process-buffer nil
23:27:11.356112 tramp-process-actions (3) # Waiting for prompts from remote shell...done
23:27:11.356392 tramp-maybe-open-connection (3) # Found remote shell prompt on ‘hackdev_django_1’
23:27:11.356539 tramp-get-connection-property (7) # remote-shell undef
23:27:11.356627 tramp-open-shell (5) # Opening remote shell ‘/bin/sh’...
23:27:11.356728 tramp-get-connection-property (7) # process-name nil
23:27:11.356801 tramp-get-connection-property (7) # remote-echo nil
23:27:11.356866 tramp-send-command (6) # exec env ENV='' HISTFILE=~/.tramp_history PROMPT_COMMAND='' PS1=\#\$\  PS2='' PS3='' /bin/sh 
23:27:11.356932 tramp-get-connection-property (7) # process-name nil
23:27:11.357004 tramp-get-connection-property (7) # chunksize nil
23:27:11.357071 tramp-set-connection-property (7) # last-cmd-time (23193 56783 357047 291000)
23:27:11.357150 tramp-get-connection-property (7) # process-buffer nil
23:27:11.357247 tramp-get-connection-property (7) # check-remote-echo nil
23:27:11.357331 tramp-get-connection-property (7) # check-remote-echo nil
23:27:11.357397 tramp-get-connection-property (7) # gateway nil
23:27:11.357542 tramp-get-connection-property (7) # check-remote-echo nil
23:27:11.357617 tramp-get-connection-property (7) # check-remote-echo nil
23:27:11.357683 tramp-get-connection-property (7) # gateway nil
23:27:11.360976 tramp-get-connection-property (7) # check-remote-echo nil
23:27:11.361162 tramp-get-connection-property (7) # check-remote-echo nil
23:27:11.361276 tramp-wait-for-regexp (6) # 
exec env ENV='' HISTFILE=~/.tramp_history PROMPT_COMMAND='' PS1=\#\$\  PS2='' PS3='' /bin/sh 
#$ 
23:27:11.361461 tramp-get-connection-property (7) # process-name nil
23:27:11.361580 tramp-get-connection-property (7) # process-name nil
23:27:11.361686 tramp-get-connection-property (7) # process-buffer nil
23:27:11.361810 tramp-get-connection-property (7) # last-cmd-time (23193 56783 357047 291000)
23:27:11.361952 tramp-get-connection-property (7) # process-name nil
23:27:11.362076 tramp-get-connection-property (7) # remote-echo nil
23:27:11.362187 tramp-send-command (6) # (cd ~/) 2>/dev/null; echo tramp_exit_status $?
23:27:11.362325 tramp-get-connection-property (7) # process-name nil
23:27:11.362451 tramp-get-connection-property (7) # chunksize nil
23:27:11.362567 tramp-set-connection-property (7) # last-cmd-time (23193 56783 362526 877000)
23:27:11.362696 tramp-get-connection-property (7) # process-buffer nil
23:27:11.362846 tramp-get-connection-property (7) # check-remote-echo nil
23:27:11.362950 tramp-get-connection-property (7) # check-remote-echo nil
23:27:11.363054 tramp-get-connection-property (7) # gateway nil
23:27:11.363227 tramp-get-connection-property (7) # check-remote-echo nil
23:27:11.363322 tramp-get-connection-property (7) # check-remote-echo nil
23:27:11.363416 tramp-get-connection-property (7) # gateway nil
23:27:11.363543 tramp-get-connection-property (7) # check-remote-echo nil
23:27:11.363626 tramp-get-connection-property (7) # check-remote-echo nil
23:27:11.363714 tramp-wait-for-regexp (6) # 
(cd ~/) 2>/dev/null; echo tramp_exit_status $?
tramp_exit_status 2
#$ 
23:27:11.363841 tramp-get-connection-property (7) # process-buffer nil
23:27:11.366005 tramp-barf-unless-okay (1) # File error: ‘tramp-histfile-override’ uses invalid file ‘~/.tramp_history’
(cd ~/) 2>/dev/null; echo tramp_exit_status $?
23:27:11.366129 tramp-open-shell (5) # Opening remote shell ‘/bin/sh’...failed
23:27:11.366571 tramp-maybe-open-connection (3) # Opening connection for hackdev_django_1 using docker...failed
23:27:11.375809 tramp-get-file-property (8) #  file-truename nil
23:27:11.375896 tramp-flush-directory-property (8) # 
23:27:11.375974 tramp-get-connection-property (7) # process-name nil
23:27:11.376065 tramp-get-connection-property (7) # process-name nil
23:27:11.376273 tramp-get-connection-property (7) # vector [docker nil hackdev_django_1 /usr/local/bin/python nil]
23:27:11.376392 tramp-process-sentinel (5) # Sentinel called: ‘#<process *tramp/docker hackdev_django_1*>’ ‘killed
’
23:27:11.376510 tramp-flush-connection-property (7) # *tramp/docker hackdev_django_1* (vector temp-file last-cmd-time)
23:27:11.376644 tramp-get-file-property (8) #  file-truename nil
23:27:11.376739 tramp-flush-directory-property (8) # 
23:27:11.389177 tramp-get-connection-property (7) # process-name nil
23:27:11.389277 tramp-flush-connection-property (7) # [docker nil hackdev_django_1 nil nil] (first-password-request)
23:27:11.389414 tramp-get-connection-property (7) # process-buffer nil
marsam commented 6 years ago

Hi, sorry for the delay

Trying to use docker-tramp with pony to connect to an interpreter inside a container

For the log output I guess "pony" refers to django pony, correct me if that is not the case.

pony-shell does not seem to be aware of default-directory so it fails in pony-command-exists-p

I think your best option is to use python-shell-make-comint:

(let ((default-directory "/docker:aeffaa3330a4:/path/to/app"))
  (python-shell-make-comint "python manage.py shell" "Python" 'show))

Tell me if it works

olymk2 commented 6 years ago

No worries appreciate the help, you are correct this is django pony I am trying to configure per project settings using dir-locals and pony mode.

I tried your code block above and got this error, I just tried executing it in an org block, not sure if you meant for me to place that in the pony src or not ?

tramp-file-name-handler: Host name must not match method "docker"

This is a sample of the pony settings i am using

((nil .
      ((pony-settings . (make-pony-project
                         :python "/docker:root@aeffaa3330a4:/usr/local/bin/python3.6"
                         :pythonpath "/app"
                         :settings "config.settings.local")
                      ))))

Thanks for replying be awesome to get this working.

marsam commented 6 years ago

I just tried executing it in an org block, not sure if you meant for me to place that in the pony src or not ?

I forgot to mention that you need to replace aeffaa3330a4 with the container ID or container name:

;;                                     ┌─────────────────────── ID or name of the container
;;                                     │            ┌────────── App path inside the container
;;                                     │            │
;;                                ━━━━━┷━━━━━━ ━━━━━┷━━━━━━
(let ((default-directory "/docker:aeffaa3330a4:/path/to/app"))
  (python-shell-make-comint "python manage.py shell --settings=config.settings.local" "Python" 'show))
;;                          ━━━━━━━━━━━━━━━━━━━━━━━━━━━┯━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
;;                                                     │
;;                                                     └─────── Command for the python interpreter

You can use the following function to autocomplete the running containers and the path

(defun my/docker-django-shell (container path)
  "Start a Django shell in docker CONTAINER with PATH."
  (interactive (list (completing-read "Container: " (mapcar #'cdr (docker-tramp--running-containers)))
                     (read-string "Path to start: ")))
  (let ((default-directory (format "/docker:%s:%s" container path)))
    (python-shell-make-comint "python manage.py shell --settings=config.settings.local" "Python" 'show)))

M-x my/docker-django-shell will ask you for the container name and the path (I think you are using /app) to start a django shell

This is a sample of the pony settings i am using

Sorry, I'm not familiar with django pony

olymk2 commented 6 years ago

Another log file. The above code does execute now, i had changed the container name but not included the path.

Looking at the logs from verbose 8 I think the other one was a lower debug level, i can see it actually trys to use /bin/sh and thats whats failing so its before it even makes it to the python commands.

Trying those command seems to work like below.

docker  exec -it  hackdev_django_1 sh
$ (cd ~/) 2>/dev/null; echo tramp_exit_status $?
tramp_exit_status 2
$ 

Pony is new to me as well, could be the issue is in pony just it seems that pony is trying to use tramp and failing on some command that its using to startup could be it missing something in pony thats required, appreciate you trying to help even though your not familiar.

;; GNU Emacs: 25.2.2 Tramp: 2.2.13.25.2 -*- mode: outline; -*-
22:05:00.499199 tramp-get-connection-property (7) # process-name nil
22:05:00.502185 tramp-get-file-property (8) # /app file-directory-p undef
22:05:00.502332 tramp-get-connection-property (7) # test undef
22:05:00.502436 tramp-get-test-command (5) # Finding a suitable ‘test’ command
22:05:00.502515 tramp-get-connection-property (7) # process-name nil
22:05:00.502590 tramp-get-connection-property (7) # process-name nil
22:05:00.502714 tramp-get-connection-property (7) # process-buffer nil
22:05:00.503121 tramp-maybe-open-connection (3) # Opening connection for hackdev_django_1 using docker...
22:05:00.506750 tramp-get-local-locale (7) # locale en_US.utf8
22:05:00.506896 tramp-get-connection-property (7) # login-args undef
22:05:00.506974 tramp-get-connection-property (7) # login-args undef
22:05:00.507054 tramp-get-connection-property (7) # process-name nil
22:05:00.507127 tramp-get-connection-property (7) # process-buffer nil
22:05:00.507492 tramp-set-connection-property (7) # vector [docker nil hackdev_django_1 /app nil]
22:05:00.507592 tramp-maybe-open-connection (6) # /bin/sh -i
22:05:00.507664 tramp-get-connection-property (7) # vector [docker nil hackdev_django_1 /app nil]
22:05:00.507754 tramp-get-connection-property (7) # check-remote-echo nil
22:05:00.507810 tramp-get-connection-property (7) # check-remote-echo nil
22:05:00.507886 tramp-get-connection-property (7) # gateway nil
22:05:00.507982 tramp-get-connection-property (7) # check-remote-echo nil
22:05:00.508041 tramp-get-connection-property (7) # check-remote-echo nil
22:05:00.508104 tramp-wait-for-regexp (6) # 
#$ 
22:05:00.508177 tramp-get-connection-property (7) # login-program undef
22:05:00.508248 tramp-get-connection-property (7) # login-args undef
22:05:00.508317 tramp-get-connection-property (7) # login-env undef
22:05:00.508385 tramp-get-connection-property (7) # async-args undef
22:05:00.508454 tramp-get-connection-property (7) # connection-timeout undef
22:05:00.508522 tramp-get-connection-property (7) # gw-args undef
22:05:00.508599 tramp-get-connection-property (7) # temp-file undef
22:05:00.508708 tramp-set-connection-property (7) # temp-file /tmp/tramp.17511nMG
22:05:00.509249 tramp-maybe-open-connection (3) # Sending command ‘exec docker  exec -it  hackdev_django_1 sh’
22:05:00.509327 tramp-get-connection-property (7) # process-name nil
22:05:00.509400 tramp-get-connection-property (7) # remote-echo nil
22:05:00.509464 tramp-send-command (6) # exec docker  exec -it  hackdev_django_1 sh
22:05:00.509530 tramp-get-connection-property (7) # process-name nil
22:05:00.509636 tramp-get-connection-property (7) # chunksize nil
22:05:00.509739 tramp-set-connection-property (7) # last-cmd-time (23201 45964 509715 388000)
22:05:00.509816 tramp-get-connection-property (7) # process-buffer nil
22:05:00.509973 tramp-set-connection-property (7) # first-password-request t
22:05:00.510126 tramp-process-actions (3) # Waiting for prompts from remote shell...
22:05:00.510301 tramp-get-connection-property (7) # gateway nil
22:05:00.552409 tramp-process-one-action (5) # Looking for regexp "\(.*\(user\|login\)\( .*\)?: *\)\'" from remote shell
22:05:00.552502 tramp-get-connection-property (7) # check-remote-echo nil
22:05:00.552566 tramp-get-connection-property (7) # check-remote-echo nil
22:05:00.552652 tramp-process-one-action (5) # Looking for regexp "\(^.*\(\(?:adgangskode\|contrase\(?:\(?:ny\|ñ\)a\)\|geslo\|h\(?:\(?:asł\|esl\)o\)\|iphasiwedi\|jelszó\|l\(?:ozinka\|ösenord\)\|m\(?:ot de passe\|ật khẩu\)\|pa\(?:rola\|s\(?:ahitza\|s\(?: phrase\|code\|ord\|phrase\|wor[dt]\)\|vorto\)\)\|s\(?:alasana\|enha\|laptažodis\)\|wachtwoord\|лозинка\|пароль\|ססמה\|كلمة السر\|गुप्तशब्द\|शब्दकूट\|গুপ্তশব্দ\|পাসওয়ার্ড\|ਪਾਸਵਰਡ\|પાસવર્ડ\|ପ୍ରବେଶ ସଙ୍କେତ\|கடவுச்சொல்\|సంకేతపదము\|ಗುಪ್ತಪದ\|അടയാളവാക്ക്\|රහස්පදය\|ពាក្យសម្ងាត់\|パスワード\|密[码碼]\|암호\)\).*: ? *\)\'" from remote shell
22:05:00.552731 tramp-get-connection-property (7) # check-remote-echo nil
22:05:00.552789 tramp-get-connection-property (7) # check-remote-echo nil
22:05:00.552872 tramp-process-one-action (5) # Looking for regexp "\(^.*\(Connection \(?:\(?:clo\|refu\)sed\)\|Host key verification failed\.\|Login \(?:[Ii]ncorrect\)\|N\(?:ame or service not known\|o supported authentication methods left to try!\)\|Permission denied\|\(?:Sorry, try again\|Timeout, server not responding\)\.\).*\|^.*\(Received signal [0-9]+\).*\)\'" from remote shell
22:05:00.552941 tramp-get-connection-property (7) # check-remote-echo nil
22:05:00.552999 tramp-get-connection-property (7) # check-remote-echo nil
22:05:00.553095 tramp-process-one-action (5) # Looking for regexp "\(^[^#$%>
]*[#$%>] *\)\'" from remote shell
22:05:00.553164 tramp-get-connection-property (7) # check-remote-echo nil
22:05:00.553240 tramp-get-connection-property (7) # check-remote-echo nil
22:05:00.553318 tramp-process-one-action (5) # Call ‘tramp-action-succeed’
22:05:00.553413 tramp-get-connection-property (7) # process-buffer nil
22:05:00.553486 tramp-process-actions (6) # 
$ 
22:05:00.553573 tramp-get-connection-property (7) # process-buffer nil
22:05:00.553748 tramp-process-actions (3) # Waiting for prompts from remote shell...done
22:05:00.553942 tramp-maybe-open-connection (3) # Found remote shell prompt on ‘hackdev_django_1’
22:05:00.554039 tramp-get-connection-property (7) # remote-shell undef
22:05:00.554113 tramp-open-shell (5) # Opening remote shell ‘/bin/sh’...
22:05:00.554216 tramp-get-connection-property (7) # process-name nil
22:05:00.554296 tramp-get-connection-property (7) # remote-echo nil
22:05:00.554455 tramp-send-command (6) # exec env ENV='' HISTFILE=~/.tramp_history PROMPT_COMMAND='' PS1=\#\$\  PS2='' PS3='' /bin/sh 
22:05:00.554546 tramp-get-connection-property (7) # process-name nil
22:05:00.554685 tramp-get-connection-property (7) # chunksize nil
22:05:00.554815 tramp-set-connection-property (7) # last-cmd-time (23201 45964 554786 482000)
22:05:00.554971 tramp-get-connection-property (7) # process-buffer nil
22:05:00.555119 tramp-get-connection-property (7) # check-remote-echo nil
22:05:00.555336 tramp-get-connection-property (7) # check-remote-echo nil
22:05:00.555447 tramp-get-connection-property (7) # gateway nil
22:05:00.555610 tramp-get-connection-property (7) # check-remote-echo nil
22:05:00.555710 tramp-get-connection-property (7) # check-remote-echo nil
22:05:00.555822 tramp-get-connection-property (7) # gateway nil
22:05:00.559359 tramp-get-connection-property (7) # check-remote-echo nil
22:05:00.559427 tramp-get-connection-property (7) # check-remote-echo nil
22:05:00.559491 tramp-wait-for-regexp (6) # 
exec env ENV='' HISTFILE=~/.tramp_history PROMPT_COMMAND='' PS1=\#\$\  PS2='' PS3='' /bin/sh 
#$ 
22:05:00.559620 tramp-get-connection-property (7) # process-name nil
22:05:00.559693 tramp-get-connection-property (7) # process-name nil
22:05:00.559761 tramp-get-connection-property (7) # process-buffer nil
22:05:00.559836 tramp-get-connection-property (7) # last-cmd-time (23201 45964 554786 482000)
22:05:00.559916 tramp-get-connection-property (7) # process-name nil
22:05:00.559986 tramp-get-connection-property (7) # remote-echo nil
22:05:00.560051 tramp-send-command (6) # (cd ~/) 2>/dev/null; echo tramp_exit_status $?
22:05:00.560117 tramp-get-connection-property (7) # process-name nil
22:05:00.560186 tramp-get-connection-property (7) # chunksize nil
22:05:00.560270 tramp-set-connection-property (7) # last-cmd-time (23201 45964 560227 782000)
22:05:00.560359 tramp-get-connection-property (7) # process-buffer nil
22:05:00.560474 tramp-get-connection-property (7) # check-remote-echo nil
22:05:00.560576 tramp-get-connection-property (7) # check-remote-echo nil
22:05:00.560679 tramp-get-connection-property (7) # gateway nil
22:05:00.560828 tramp-get-connection-property (7) # check-remote-echo nil
22:05:00.560968 tramp-get-connection-property (7) # check-remote-echo nil
22:05:00.561055 tramp-get-connection-property (7) # gateway nil
22:05:00.561177 tramp-get-connection-property (7) # check-remote-echo nil
22:05:00.561236 tramp-get-connection-property (7) # check-remote-echo nil
22:05:00.561296 tramp-wait-for-regexp (6) # 
(cd ~/) 2>/dev/null; echo tramp_exit_status $?
tramp_exit_status 2
#$ 
22:05:00.561370 tramp-get-connection-property (7) # process-buffer nil
22:05:00.562501 tramp-barf-unless-okay (1) # File error: ‘tramp-histfile-override’ uses invalid file ‘~/.tramp_history’
(cd ~/) 2>/dev/null; echo tramp_exit_status $?
22:05:00.562572 tramp-open-shell (5) # Opening remote shell ‘/bin/sh’...failed
22:05:00.562814 tramp-maybe-open-connection (3) # Opening connection for hackdev_django_1 using docker...failed
22:05:00.573103 tramp-get-file-property (8) #  file-truename nil
22:05:00.573196 tramp-flush-directory-property (8) # 
22:05:00.573273 tramp-get-connection-property (7) # process-name nil
22:05:00.573345 tramp-get-connection-property (7) # process-name nil
22:05:00.573579 tramp-get-connection-property (7) # vector [docker nil hackdev_django_1 /app nil]
22:05:00.573684 tramp-process-sentinel (5) # Sentinel called: ‘#<process *tramp/docker hackdev_django_1*>’ ‘killed
’
22:05:00.573788 tramp-flush-connection-property (7) # *tramp/docker hackdev_django_1* (vector temp-file last-cmd-time)
22:05:00.573931 tramp-get-file-property (8) #  file-truename nil
22:05:00.574015 tramp-flush-directory-property (8) # 
22:05:00.580474 tramp-get-connection-property (7) # process-name nil
22:05:00.580583 tramp-flush-connection-property (7) # [docker nil hackdev_django_1 nil nil] (first-password-request)
22:05:00.580715 tramp-get-connection-property (7) # process-buffer nil
22:05:13.365703 tramp-get-file-property (8) # /usr/local/bin/python file-directory-p undef
22:05:13.365800 tramp-get-connection-property (7) # test undef
22:05:13.365866 tramp-get-test-command (5) # Finding a suitable ‘test’ command
22:05:13.365940 tramp-get-connection-property (7) # process-name nil
22:05:13.366009 tramp-get-connection-property (7) # process-name nil
22:05:13.366073 tramp-get-connection-property (7) # process-buffer nil
22:05:13.366264 tramp-maybe-open-connection (3) # Opening connection for hackdev_django_1 using docker...
22:05:13.366493 tramp-call-process (6) # ‘locale -a’ nil  *temp*-96602
22:05:13.367465 tramp-call-process (6) # 0
C
C.UTF-8
en_AG
en_AG.utf8
en_AU.utf8
en_BW.utf8
en_CA.utf8
en_DK.utf8
en_GB.utf8
en_HK.utf8
en_IE.utf8
en_IL
en_IL.utf8
en_IN
en_IN.utf8
en_NG
en_NG.utf8
en_NZ.utf8
en_PH.utf8
en_SG.utf8
en_US.utf8
en_ZA.utf8
en_ZM
en_ZM.utf8
en_ZW.utf8
POSIX
22:05:13.367713 tramp-get-local-locale (7) # locale en_US.utf8
22:05:13.367964 tramp-get-connection-property (7) # login-args undef
22:05:13.368102 tramp-get-connection-property (7) # login-args undef
22:05:13.368204 tramp-get-connection-property (7) # process-name nil
22:05:13.368277 tramp-get-connection-property (7) # process-buffer nil
22:05:13.368724 tramp-set-connection-property (7) # vector [docker nil hackdev_django_1 /usr/local/bin/python nil]
22:05:13.368891 tramp-maybe-open-connection (6) # /bin/sh -i
22:05:13.369017 tramp-get-connection-property (7) # vector [docker nil hackdev_django_1 /usr/local/bin/python nil]
22:05:13.369210 tramp-get-connection-property (7) # check-remote-echo nil
22:05:13.369368 tramp-get-connection-property (7) # check-remote-echo nil
22:05:13.369516 tramp-get-connection-property (7) # gateway nil
22:05:13.369618 tramp-get-connection-property (7) # check-remote-echo nil
22:05:13.369678 tramp-get-connection-property (7) # check-remote-echo nil
22:05:13.369743 tramp-wait-for-regexp (6) # 
#$ 
22:05:13.369857 tramp-get-connection-property (7) # login-program undef
22:05:13.369935 tramp-get-connection-property (7) # login-args undef
22:05:13.370008 tramp-get-connection-property (7) # login-env undef
22:05:13.370080 tramp-get-connection-property (7) # async-args undef
22:05:13.370157 tramp-get-connection-property (7) # connection-timeout undef
22:05:13.370282 tramp-get-connection-property (7) # gw-args undef
22:05:13.370364 tramp-get-connection-property (7) # temp-file undef
22:05:13.370488 tramp-set-connection-property (7) # temp-file /tmp/tramp.175110WM
22:05:13.371209 tramp-maybe-open-connection (3) # Sending command ‘exec docker  exec -it  hackdev_django_1 sh’
22:05:13.371312 tramp-get-connection-property (7) # process-name nil
22:05:13.371391 tramp-get-connection-property (7) # remote-echo nil
22:05:13.371477 tramp-send-command (6) # exec docker  exec -it  hackdev_django_1 sh
22:05:13.371580 tramp-get-connection-property (7) # process-name nil
22:05:13.371664 tramp-get-connection-property (7) # chunksize nil
22:05:13.371728 tramp-set-connection-property (7) # last-cmd-time (23201 45977 371704 773000)
22:05:13.371802 tramp-get-connection-property (7) # process-buffer nil
22:05:13.371947 tramp-set-connection-property (7) # first-password-request t
22:05:13.372123 tramp-process-actions (3) # Waiting for prompts from remote shell...
22:05:13.372317 tramp-get-connection-property (7) # gateway nil
22:05:13.413844 tramp-process-one-action (5) # Looking for regexp "\(.*\(user\|login\)\( .*\)?: *\)\'" from remote shell
22:05:13.413944 tramp-get-connection-property (7) # check-remote-echo nil
22:05:13.414012 tramp-get-connection-property (7) # check-remote-echo nil
22:05:13.414103 tramp-process-one-action (5) # Looking for regexp "\(^.*\(\(?:adgangskode\|contrase\(?:\(?:ny\|ñ\)a\)\|geslo\|h\(?:\(?:asł\|esl\)o\)\|iphasiwedi\|jelszó\|l\(?:ozinka\|ösenord\)\|m\(?:ot de passe\|ật khẩu\)\|pa\(?:rola\|s\(?:ahitza\|s\(?: phrase\|code\|ord\|phrase\|wor[dt]\)\|vorto\)\)\|s\(?:alasana\|enha\|laptažodis\)\|wachtwoord\|лозинка\|пароль\|ססמה\|كلمة السر\|गुप्तशब्द\|शब्दकूट\|গুপ্তশব্দ\|পাসওয়ার্ড\|ਪਾਸਵਰਡ\|પાસવર્ડ\|ପ୍ରବେଶ ସଙ୍କେତ\|கடவுச்சொல்\|సంకేతపదము\|ಗುಪ್ತಪದ\|അടയാളവാക്ക്\|රහස්පදය\|ពាក្យសម្ងាត់\|パスワード\|密[码碼]\|암호\)\).*: ? *\)\'" from remote shell
22:05:13.414191 tramp-get-connection-property (7) # check-remote-echo nil
22:05:13.414253 tramp-get-connection-property (7) # check-remote-echo nil
22:05:13.414342 tramp-process-one-action (5) # Looking for regexp "\(^.*\(Connection \(?:\(?:clo\|refu\)sed\)\|Host key verification failed\.\|Login \(?:[Ii]ncorrect\)\|N\(?:ame or service not known\|o supported authentication methods left to try!\)\|Permission denied\|\(?:Sorry, try again\|Timeout, server not responding\)\.\).*\|^.*\(Received signal [0-9]+\).*\)\'" from remote shell
22:05:13.414417 tramp-get-connection-property (7) # check-remote-echo nil
22:05:13.414479 tramp-get-connection-property (7) # check-remote-echo nil
22:05:13.414558 tramp-process-one-action (5) # Looking for regexp "\(^[^#$%>
]*[#$%>] *\)\'" from remote shell
22:05:13.414626 tramp-get-connection-property (7) # check-remote-echo nil
22:05:13.414701 tramp-get-connection-property (7) # check-remote-echo nil
22:05:13.414777 tramp-process-one-action (5) # Call ‘tramp-action-succeed’
22:05:13.414909 tramp-get-connection-property (7) # process-buffer nil
22:05:13.414982 tramp-process-actions (6) # 
$ 
22:05:13.415052 tramp-get-connection-property (7) # process-buffer nil
22:05:13.415228 tramp-process-actions (3) # Waiting for prompts from remote shell...done
22:05:13.415440 tramp-maybe-open-connection (3) # Found remote shell prompt on ‘hackdev_django_1’
22:05:13.415547 tramp-get-connection-property (7) # remote-shell undef
22:05:13.415623 tramp-open-shell (5) # Opening remote shell ‘/bin/sh’...
22:05:13.415722 tramp-get-connection-property (7) # process-name nil
22:05:13.415800 tramp-get-connection-property (7) # remote-echo nil
22:05:13.415870 tramp-send-command (6) # exec env ENV='' HISTFILE=~/.tramp_history PROMPT_COMMAND='' PS1=\#\$\  PS2='' PS3='' /bin/sh 
22:05:13.415942 tramp-get-connection-property (7) # process-name nil
22:05:13.416017 tramp-get-connection-property (7) # chunksize nil
22:05:13.416089 tramp-set-connection-property (7) # last-cmd-time (23201 45977 416063 539000)
22:05:13.416174 tramp-get-connection-property (7) # process-buffer nil
22:05:13.416271 tramp-get-connection-property (7) # check-remote-echo nil
22:05:13.416348 tramp-get-connection-property (7) # check-remote-echo nil
22:05:13.416416 tramp-get-connection-property (7) # gateway nil
22:05:13.416629 tramp-get-connection-property (7) # check-remote-echo nil
22:05:13.416702 tramp-get-connection-property (7) # check-remote-echo nil
22:05:13.416778 tramp-get-connection-property (7) # gateway nil
22:05:13.417460 tramp-get-connection-property (7) # check-remote-echo nil
22:05:13.417529 tramp-get-connection-property (7) # check-remote-echo nil
22:05:13.417597 tramp-wait-for-regexp (6) # 
exec env ENV='' HISTFILE=~/.tramp_history PROMPT_COMMAND='' PS1=\#\$\  PS2='' PS3='' /bin/sh 
#$ 
22:05:13.417747 tramp-get-connection-property (7) # process-name nil
22:05:13.417857 tramp-get-connection-property (7) # process-name nil
22:05:13.417969 tramp-get-connection-property (7) # process-buffer nil
22:05:13.418121 tramp-get-connection-property (7) # last-cmd-time (23201 45977 416063 539000)
22:05:13.418216 tramp-get-connection-property (7) # process-name nil
22:05:13.418291 tramp-get-connection-property (7) # remote-echo nil
22:05:13.418361 tramp-send-command (6) # (cd ~/) 2>/dev/null; echo tramp_exit_status $?
22:05:13.418434 tramp-get-connection-property (7) # process-name nil
22:05:13.418510 tramp-get-connection-property (7) # chunksize nil
22:05:13.418581 tramp-set-connection-property (7) # last-cmd-time (23201 45977 418555 670000)
22:05:13.418674 tramp-get-connection-property (7) # process-buffer nil
22:05:13.418771 tramp-get-connection-property (7) # check-remote-echo nil
22:05:13.418852 tramp-get-connection-property (7) # check-remote-echo nil
22:05:13.418923 tramp-get-connection-property (7) # gateway nil
22:05:13.419064 tramp-get-connection-property (7) # check-remote-echo nil
22:05:13.419160 tramp-get-connection-property (7) # check-remote-echo nil
22:05:13.419236 tramp-get-connection-property (7) # gateway nil
22:05:13.419372 tramp-get-connection-property (7) # check-remote-echo nil
22:05:13.419436 tramp-get-connection-property (7) # check-remote-echo nil
22:05:13.419502 tramp-wait-for-regexp (6) # 
(cd ~/) 2>/dev/null; echo tramp_exit_status $?
tramp_exit_status 2
#$ 
22:05:13.419587 tramp-get-connection-property (7) # process-buffer nil
22:05:13.421280 tramp-barf-unless-okay (1) # File error: ‘tramp-histfile-override’ uses invalid file ‘~/.tramp_history’
(cd ~/) 2>/dev/null; echo tramp_exit_status $?
22:05:13.421355 tramp-open-shell (5) # Opening remote shell ‘/bin/sh’...failed
22:05:13.421617 tramp-maybe-open-connection (3) # Opening connection for hackdev_django_1 using docker...failed
22:05:13.421719 tramp-get-file-property (8) #  file-truename nil
22:05:13.421798 tramp-flush-directory-property (8) # 
22:05:13.421880 tramp-get-connection-property (7) # process-name nil
22:05:13.421956 tramp-get-connection-property (7) # process-name nil
22:05:13.422105 tramp-get-connection-property (7) # vector [docker nil hackdev_django_1 /usr/local/bin/python nil]
22:05:13.422190 tramp-process-sentinel (5) # Sentinel called: ‘#<process *tramp/docker hackdev_django_1*>’ ‘killed
’
22:05:13.422274 tramp-flush-connection-property (7) # *tramp/docker hackdev_django_1* (vector temp-file last-cmd-time)
22:05:13.422371 tramp-get-file-property (8) #  file-truename nil
22:05:13.422442 tramp-flush-directory-property (8) # 
22:05:13.438748 tramp-get-connection-property (7) # process-name nil
22:05:13.438862 tramp-flush-connection-property (7) # [docker nil hackdev_django_1 nil nil] (first-password-request)
22:05:13.438995 tramp-get-connection-property (7) # process-buffer nil
marsam commented 6 years ago

The above code does execute now, i had changed the container name but not included the path.

cool, if the snippet went well, it should have shown a python repl from the container

could be the issue is in pony just it seems that pony is trying to use tramp and failing on some command that its using to startup could be it missing something in pony thats required, appreciate you trying to help even though your not familiar.

Yeah, django pony is not aware of default-directory, so pony-shell won't work unless a significant changes are made in django pony.

marsam commented 6 years ago

I'm closing this because seems to be an issue with django pony. Feel free to ask if you have any further questions.

olymk2 commented 6 years ago

Been experimenting a bit more just connecting to containers using run-python, tried the below

(setq python-shell-interpreter "/docker:root@djtrak_django_1:/usr/local/bin/python") 

when I run run-python I get the following.

tramp-error: Not a Tramp file name: "/docker\:root\@djtrak_django_1\:/usr/local/bin/python

I can open files using the above format, and have verified the python path with which command so at a bit of a loss, I assume it something to do with the escape characters which are added ?