[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
master 4998d5bdf3 1/2: Provide Podman containers on their own method in
From: |
Michael Albinus |
Subject: |
master 4998d5bdf3 1/2: Provide Podman containers on their own method in Tramp |
Date: |
Tue, 4 Oct 2022 12:56:49 -0400 (EDT) |
branch: master
commit 4998d5bdf3a3b61769db3020db642465f5d59e70
Author: Brian Cully <bjc@kublai.com>
Commit: Michael Albinus <michael.albinus@gmx.de>
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.
---
lisp/net/tramp-docker.el | 41 ++++++++++++++++++++++++++++++++++++-----
1 file changed, 36 insertions(+), 5 deletions(-)
diff --git a/lisp/net/tramp-docker.el b/lisp/net/tramp-docker.el
index 12fabfe7ba..b74bdddddd 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,16 +50,27 @@
: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
(defconst tramp-docker-method "docker"
"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