Check the @samp{Share SSH connections if possible} control for that
session.
+@item @option{docker}
+@cindex method @option{docker}
+@cindex @option{docker} method
+
+Integration for Docker containers. A container is accessed via
+@file{@trampfn{docker,user@@container,/path/to/file}}, where
+@samp{user} is the (optional) user that you want to use, and
+@samp{container} is the id or name of the container.
+
@end table
@c @item ibuffer-tramp.el
@c Contact Svend Sorensen <svend@@ciffer.net>
-@item docker-tramp
-@cindex method @option{docker}
-@cindex @option{docker} method
-Integration for Docker containers. A container is accessed via
-@file{@trampfn{docker,user@@container,/path/to/file}}, where
-@samp{user} is the (optional) user that you want to use, and
-@samp{container} is the id or name of the container.
-
@item kubernetes-tramp
@cindex method @option{kubectl}
@cindex @option{kubectl} method
-Integration for Docker containers deployed in a Kubernetes cluster.
-It is derived from @samp{docker-tramp}. A container is accessed via
+Integration for Docker containers deployed in a Kubernetes cluster. A
+container is accessed via
@file{@trampfn{kubectl,user@@container,/path/to/file}}, @samp{user}
-and @samp{container} have the same meaning as in @samp{docker-tramp}.
+and @samp{container} have the same meaning as with the @option{docker}
+method.
@item lxc-tramp
@cindex method @option{lxc}
@cindex @option{lxc} method
Integration for LXC containers. A container is accessed via
@file{@trampfn{lxc,container,/path/to/file}}, @samp{container} has the
-same meaning as in @samp{docker-tramp}. A @samp{user} specification
-is ignored.
+same meaning as with the @option{docker} method. A @samp{user}
+specification is ignored.
@item lxd-tramp
@cindex method @option{lxd}
@cindex @option{lxd} method
Integration for LXD containers. A container is accessed via
@file{@trampfn{lxd,user@@container,/path/to/file}}, @samp{user} and
-@samp{container} have the same meaning as in @samp{docker-tramp}.
+@samp{container} have the same meaning as with the @option{docker}
+method.
@item magit-tramp
@cindex method @option{git}
---
** The thumbs.el library is now obsolete.
-We recommend using `M-x image-dired' instead.
+We recommend using 'M-x image-dired' instead.
---
** The autoarg.el library is now marked obsolete.
foo &&
bar
-*** New Flymake backend using the ShellCheck program
+*** New Flymake backend using the ShellCheck program.
It is enabled by default, but requires that the external "shellcheck"
command is installed.
** Tramp
++++
+*** New connection method "docker".
+It allows accessing environments provided by Docker.
+
---
*** Tramp supports abbreviating remote home directories now.
When calling 'abbreviate-file-name' on a Tramp file name, the result
signal an error in any file.)
In addition, files are scanned in a slightly different way.
-Previously ';;;###' specs inside a top-level form (i.e., something
+Previously, ';;;###' specs inside a top-level form (i.e., something
like '(when ... ;;;### ...)' would be ignored. They are now parsed as
normal.
---
** '?\' at the end of a line now signals an error.
-Previously it produced a nonsense value, -1, that was never intended.
+Previously, it produced a nonsense value, -1, that was never intended.
---
** Some libraries obsolete since Emacs 24.1 and 24.3 have been removed:
;; Copyright © 2022 Free Software Foundation, Inc.
;; Author: Brian Cully <bjc@kublai.com>
-;; Maintainer: Brian Cully <bjc@kublai.com>
-;; URL: https://git.spork.org/tramp-docker
-;; Keywords: tramp, docker
-;; Version: 0.99.1
-;; Package-Requires: ((emacs "23"))
+;; Keywords: comm, processes
+;; Package: tramp
-;;; License:
+;; This file is part of GNU Emacs.
-;; This program is free software; you can redistribute it and/or
-;; modify it under the terms of the GNU General Public License as
-;; published by the Free Software Foundation, either version 3 of the
-;; License, or (at your option) any later version.
+;; GNU Emacs is free software: you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
-;; This program is distributed in the hope that it will be useful, but
-;; WITHOUT ANY WARRANTY; without even the implied warranty of
-;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-;; General Public License for more details.
+;; GNU Emacs is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+;; GNU General Public License for more details.
;; You should have received a copy of the GNU General Public License
-;; along with this program. If not, see <http://www.gnu.org/licenses/>.
+;; along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>.
;;; Commentary:
-;;
;; ‘tramp-docker’ allows Tramp access to environments provided by
;; Docker.
;;
;; ## Usage
;;
-;; Call ‘tramp-docker-setup’ in your Emacs initialization.
-;;
-;; (add-hook 'after-init-hook 'tramp-docker-setup)
-;;
;; Open a file on a running systemd-docker container:
;;
;; C-x C-f /docker:USER@CONTAINER:/path/to/file
;; Where:
;; USER is the user on the container to connect as (optional)
;; CONTAINER is the container to connect to
-;;
;;; Code:
-\f
-(require 'tramp)
-(defgroup tramp-docker nil
- "Tramp integration for Docker containers."
- :prefix "tramp-docker-"
- :group 'applications
- :link '(url-link :tag "repo" "https://git.spork.org/tramp-docker.git")
- :link '(emacs-commentary-link :tag "Commentary" "tramp-docker"))
+(require 'tramp)
+;;;###tramp-autoload
(defcustom tramp-docker-program "docker"
"Name of the Docker client program."
+ :group 'tramp
+ :version "29.1"
:type '(choice (const "docker")
(const "podman")
- (string))
- :group 'tramp-docker)
+ (string)))
+;;;###tramp-autoload
(defconst tramp-docker-method "docker"
"Tramp method name to use to connect to Docker containers.")
(defun tramp-docker--completion-function (&rest _args)
"List Docker containers available for connection.
-This function is used by ‘tramp-set-completion-function’, please
+This function is used by `tramp-set-completion-function', please
see its function help for a description of the format."
(let* ((raw-list (shell-command-to-string
(concat tramp-docker-program
(mapcar (lambda (m) (list nil m)) machines)))
;; todo: check tramp-async-args and tramp-direct-async
-(defun tramp-docker--add-method ()
- "Add Tramp method handler for Docker containers."
- (push `(,tramp-docker-method
- (tramp-login-program ,tramp-docker-program)
- (tramp-login-args (("exec")
- ("-it")
- ("-u" "%u")
- ("%h")
- ("/bin/sh")))
- (tramp-remote-shell "/bin/sh")
- (tramp-remote-shell-login ("-l"))
- (tramp-remote-shell-args ("-i" "-c")))
- tramp-methods))
-
-(defun tramp-docker--remove-method ()
- "Remove Tramp method handler for docker containers."
- (setf (alist-get tramp-docker-method tramp-methods nil t 'string=) nil))
-
-(defun tramp-docker-unload-function ()
- "Remove Tramp method handler and completion functions."
- (tramp-set-completion-function tramp-docker-method nil)
- (tramp-docker--remove-method)
- nil)
-
-(when nil
- (load-file (buffer-file-name))
- (setq tramp-docker-program "doas podman")
- (setq tramp-verbose 7) ;; default 3
- (tramp-docker-setup)
- (tramp-docker-unload-function))
-
-;;;###autoload
-(defun tramp-docker-setup ()
- "Initialize Docker support for Tramp."
- (tramp-docker--add-method)
- (tramp-set-completion-function tramp-docker-method
- '((tramp-docker--completion-function ""))))
+;;;###tramp-autoload
+(tramp--with-startup
+ (push `(,tramp-docker-method
+ (tramp-login-program ,tramp-docker-program)
+ (tramp-login-args (("exec")
+ ("-it")
+ ("-u" "%u")
+ ("%h")
+ ("/bin/sh")))
+ (tramp-remote-shell "/bin/sh")
+ (tramp-remote-shell-login ("-l"))
+ (tramp-remote-shell-args ("-i" "-c")))
+ tramp-methods)
+
+ (tramp-set-completion-function
+ tramp-docker-method
+ '((tramp-docker--completion-function ""))))
+
+(add-hook 'tramp-unload-hook
+ (lambda ()
+ (unload-feature 'tramp-docker 'force)))
(provide 'tramp-docker)
+
;;; tramp-docker.el ends here