summaryrefslogtreecommitdiff
path: root/lisp
diff options
context:
space:
mode:
authorBrian Cully <bjc@kublai.com>2022-10-04 18:56:23 +0200
committerMichael Albinus <michael.albinus@gmx.de>2022-10-04 18:56:23 +0200
commit4998d5bdf3a3b61769db3020db642465f5d59e70 (patch)
treea71978f33b164dd8bfc639bc208121a8e3ed5473 /lisp
parentd543fdcb218bb2fadfd0277e8a0171afed15d75e (diff)
downloademacs-4998d5bdf3a3b61769db3020db642465f5d59e70.tar.gz
emacs-4998d5bdf3a3b61769db3020db642465f5d59e70.tar.bz2
emacs-4998d5bdf3a3b61769db3020db642465f5d59e70.zip
Provide Podman containers on their own method in Tramp
* lisp/net/tramp-docker.el (tramp-podman-program): New defcustom. (tramp-podman-method): New defconst. (tramp-docker-program): Remove "podman" from option list. (top): Update comments to refer to Docker-alike where necessary. Add description for how to use the podman method.
Diffstat (limited to 'lisp')
-rw-r--r--lisp/net/tramp-docker.el41
1 files changed, 36 insertions, 5 deletions
diff --git a/lisp/net/tramp-docker.el b/lisp/net/tramp-docker.el
index 12fabfe7ba0..b74bdddddd2 100644
--- a/lisp/net/tramp-docker.el
+++ b/lisp/net/tramp-docker.el
@@ -1,4 +1,4 @@
-;;; tramp-docker.el --- Tramp integration for Docker containers -*- lexical-binding: t; -*-
+;;; tramp-docker.el --- Tramp integration for Docker-like containers -*- lexical-binding: t; -*-
;; Copyright © 2022 Free Software Foundation, Inc.
@@ -24,14 +24,18 @@
;;; Commentary:
;; ‘tramp-docker’ allows Tramp access to environments provided by
-;; Docker.
+;; Docker and similar programs.
;;
;; ## Usage
;;
-;; Open a file on a running systemd-docker container:
+;; Open a file on a running Docker container:
;;
;; C-x C-f /docker:USER@CONTAINER:/path/to/file
;;
+;; or Podman:
+;;
+;; C-x C-f /podman:USER@CONTAINER:/path/to/file
+;;
;; Where:
;; USER is the user on the container to connect as (optional)
;; CONTAINER is the container to connect to
@@ -46,7 +50,14 @@
:group 'tramp
:version "29.1"
:type '(choice (const "docker")
- (const "podman")
+ (string)))
+
+;;;###tramp-autoload
+(defcustom tramp-podman-program "podman"
+ "Name of the Podman client program."
+ :group 'tramp
+ :version "29.1"
+ :type '(choice (const "podman")
(string)))
;;;###tramp-autoload
@@ -54,8 +65,12 @@
"Tramp method name to use to connect to Docker containers.")
;;;###tramp-autoload
+(defconst tramp-podman-method "podman"
+ "Tramp method name to use to connect to Podman containers.")
+
+;;;###tramp-autoload
(defun tramp-docker--completion-function (&rest _args)
- "List Docker containers available for connection.
+ "List Docker-like containers available for connection.
This function is used by `tramp-set-completion-function', please
see its function help for a description of the format."
@@ -90,8 +105,24 @@ see its function help for a description of the format."
(tramp-remote-shell-args ("-i" "-c")))
tramp-methods)
+ (push `(,tramp-podman-method
+ (tramp-login-program ,tramp-podman-program)
+ (tramp-login-args (("exec")
+ ("-it")
+ ("-u" "%u")
+ ("%h")
+ ("%l")))
+ (tramp-remote-shell ,tramp-default-remote-shell)
+ (tramp-remote-shell-login ("-l"))
+ (tramp-remote-shell-args ("-i" "-c")))
+ tramp-methods)
+
(tramp-set-completion-function
tramp-docker-method
+ '((tramp-docker--completion-function "")))
+
+ (tramp-set-completion-function
+ tramp-podman-method
'((tramp-docker--completion-function ""))))
(add-hook 'tramp-unload-hook