Somehow the following minimal emacs config breaks docker-tramp. Completion in the mini-buffer does not work for /docker:, nor the container ids/names like /docker:43893ad331df, and once you type out the full tramp string like: /docker:43893ad331df/ completion then suggests files from the host fs where emacs is running, not from the docker container fs, and if you type out the path to a file that exists in both fs' then it will be opened on the host fs not the container fs, and a file that only exists on the container fs will not be found at all.

(setq package-archives '(("gnu" . "http://elpa.gnu.org/packages/")("melpa" . "http://melpa.milkbox.net/packages/")))
(add-to-list 'load-path (concat "~/.emacs.d/" (file-name-as-directory "elpa")))

(require 'tramp)
(setq tramp-verbose 9)
(require 'docker-tramp)

(defvar ido-dont-ignore-buffer-names '("*scratch*" "*Occur*"))

(defun ido-ignore-most-star-buffers (name)
   (string-match-p "^*" name)
   (not (member name ido-dont-ignore-buffer-names))))

(defun bind-ido-keys ()
  "Keybindings for ido mode."
  (define-key ido-completion-map "\C-n" 'ido-toggle-ignore))
(add-hook 'ido-setup-hook #'bind-ido-keys)

(ido-mode 1)
(setq ido-use-virtual-buffers t)
(add-to-list 'ido-ignore-buffers 'ido-ignore-most-star-buffers)

Any idea what is going on, and how to fix it?

Edit: The issue went away with emacs 27.1. No idea why.

  • Are you sure that you can't narrow this down even more? I doubt the keyboard shortcut is what is causing the problem, for example.
    – db48x
    Commented Jun 8, 2020 at 19:45
  • The init code you provided worked for me (Linux) - I was actually surprised to see my containers autocompleted for me. File completion using Ido worked as well. Is your user able to execute docker ps without sudo?
    – gregoryg
    Commented Jun 9, 2020 at 19:53
  • Yes, my user can execute docker ps without sudo. If I comment out the ido-stuff then the tramp stuff works. Commented Jun 9, 2020 at 19:54


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.