commit 0d7b635bd685ada80368338d4e3e63b221913c63 parent ee7a49938789662d4df9f75a2f63f45f791053a9 Author: Cem Keylan <cem@ckyln.com> Date: Fri, 13 Mar 2020 18:16:17 +0300 add docker tramp Diffstat:
M | init.org | | | 24 | ++++++++++++++++++++++++ |
1 file changed, 24 insertions(+), 0 deletions(-)
diff --git a/init.org b/init.org @@ -466,6 +466,30 @@ not have a =--dired= option. Let's disable it. (setq dired-use-ls-dired nil) #+END_SRC +** Docker +I got this tramp configuration from [[https://willschenk.com/articles/2020/tramp_tricks]] +#+BEGIN_SRC emacs-lisp +(push + (cons + "docker" + '((tramp-login-program "docker") + (tramp-login-args (("exec" "-it") ("%h") ("/bin/bash"))) + (tramp-remote-shell "/bin/sh") + (tramp-remote-shell-args ("-i") ("-c")))) + tramp-methods) + +(defadvice tramp-completion-handle-file-name-all-completions + (around dotemacs-completion-docker activate) + "(tramp-completion-handle-file-name-all-completions \"\" \"/docker:\" returns + a list of active Docker container names, followed by colons." + (if (equal (ad-get-arg 1) "/docker:") + (let* ((dockernames-raw (shell-command-to-string "docker ps | awk '$NF != \"NAMES\" { print $NF \":\" }'")) + (dockernames (cl-remove-if-not + #'(lambda (dockerline) (string-match ":$" dockerline)) + (split-string dockernames-raw "\n")))) + (setq ad-return-value dockernames)) + ad-do-it)) +#+END_SRC ** Backup Options #+BEGIN_SRC emacs-lisp