* master 152c7322c1: * lisp/net/tramp-docker.el: New file.
@ 2022-09-29 16:50 miha
2022-09-29 17:28 ` Michael Albinus
0 siblings, 1 reply; 14+ messages in thread
From: miha @ 2022-09-29 16:50 UTC (permalink / raw)
To: Michael.Albinus; +Cc: Brian Cully, emacs-devel
[-- Attachment #1: Type: text/plain, Size: 580 bytes --]
> +(defcustom tramp-docker-program "docker"
> + "Name of the Docker client program."
> + :type '(choice (const "docker")
> + (const "podman")
> + (string))
> + :group 'tramp-docker)
It's not unusual to have both podman and docker containers on the same
host. But the way tramp-docker.el is arranged currently, it's difficult
to have simultaneous tramp connections to both of them. I think it would
make sense to have two tramp methods: '/docker:' and '/podman:', and by
extension, two defcustoms: tramp-docker-program and
tramp-podman-program.
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 861 bytes --]
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: master 152c7322c1: * lisp/net/tramp-docker.el: New file.
2022-09-29 16:50 master 152c7322c1: * lisp/net/tramp-docker.el: New file miha
@ 2022-09-29 17:28 ` Michael Albinus
2022-10-03 13:44 ` Brian Cully via Emacs development discussions.
0 siblings, 1 reply; 14+ messages in thread
From: Michael Albinus @ 2022-09-29 17:28 UTC (permalink / raw)
To: miha; +Cc: Brian Cully, emacs-devel
miha@kamnitnik.top writes:
Hi Miha,
>> +(defcustom tramp-docker-program "docker"
>> + "Name of the Docker client program."
>> + :type '(choice (const "docker")
>> + (const "podman")
>> + (string))
>> + :group 'tramp-docker)
>
> It's not unusual to have both podman and docker containers on the same
> host. But the way tramp-docker.el is arranged currently, it's difficult
> to have simultaneous tramp connections to both of them. I think it would
> make sense to have two tramp methods: '/docker:' and '/podman:', and by
> extension, two defcustoms: tramp-docker-program and
> tramp-podman-program.
I agree. Especially, when we have multi-hops to different machines,
which could offer either docker or podman executables.
Brian?
Best regards, Michael.
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: master 152c7322c1: * lisp/net/tramp-docker.el: New file.
2022-09-29 17:28 ` Michael Albinus
@ 2022-10-03 13:44 ` Brian Cully via Emacs development discussions.
2022-10-03 17:37 ` Michael Albinus
0 siblings, 1 reply; 14+ messages in thread
From: Brian Cully via Emacs development discussions. @ 2022-10-03 13:44 UTC (permalink / raw)
To: Michael Albinus, miha; +Cc: Brian Cully, emacs-devel
On 9/29/22 13:28, Michael Albinus wrote:
> miha@kamnitnik.top writes:
>> It's not unusual to have both podman and docker containers on the same
>> host. But the way tramp-docker.el is arranged currently, it's difficult
>> to have simultaneous tramp connections to both of them. I think it would
>> make sense to have two tramp methods: '/docker:' and '/podman:', and by
>> extension, two defcustoms: tramp-docker-program and
>> tramp-podman-program.
>
> I agree. Especially, when we have multi-hops to different machines,
> which could offer either docker or podman executables.
>
> Brian?
Indeed. I hadn't considered this use-case (even though I also have both
installed, though I only use Tramp with Podman containers for
development purposes).
As the package is really not much more than the method and variable
customization options, it may be best to just have duplicates for those
(eg, both `tramp-docker-program' and `tramp-podman-program'). The
completion code could be shared, but I'm unsure how higher-level code
organization would work. My first pass would be to have a single
`tramp-docker--completion-function' which is used for both the
`tramp-podman-method' as well as `tramp-docker-method'. My rationale
being that Podman explicitly copies the Docker command line so that at
can be used as a drop-in replacement, so the completion function would
more naturally be associated with Docker than Podman.
-bjc
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: master 152c7322c1: * lisp/net/tramp-docker.el: New file.
2022-10-03 13:44 ` Brian Cully via Emacs development discussions.
@ 2022-10-03 17:37 ` Michael Albinus
2022-10-04 15:32 ` Brian Cully via Emacs development discussions.
0 siblings, 1 reply; 14+ messages in thread
From: Michael Albinus @ 2022-10-03 17:37 UTC (permalink / raw)
To: Brian Cully; +Cc: miha, Brian Cully, emacs-devel
Brian Cully <bjc@spork.org> writes:
Hi Brian,
> Indeed. I hadn't considered this use-case (even though I also have
> both installed, though I only use Tramp with Podman containers for
> development purposes).
>
> As the package is really not much more than the method and variable
> customization options, it may be best to just have duplicates for
> those (eg, both `tramp-docker-program' and
> `tramp-podman-program'). The completion code could be shared, but I'm
> unsure how higher-level code organization would work. My first pass
> would be to have a single `tramp-docker--completion-function' which is
> used for both the `tramp-podman-method' as well as
> `tramp-docker-method'. My rationale being that Podman explicitly
> copies the Docker command line so that at can be used as a drop-in
> replacement, so the completion function would more naturally be
> associated with Docker than Podman.
OK. Would you like to provide a patch? Including a ChangeLog-like commit
message.
> -bjc
Best regards, Michael.
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: master 152c7322c1: * lisp/net/tramp-docker.el: New file.
2022-10-03 17:37 ` Michael Albinus
@ 2022-10-04 15:32 ` Brian Cully via Emacs development discussions.
2022-10-04 16:58 ` Michael Albinus
0 siblings, 1 reply; 14+ messages in thread
From: Brian Cully via Emacs development discussions. @ 2022-10-04 15:32 UTC (permalink / raw)
To: Michael Albinus; +Cc: miha, Brian Cully, emacs-devel
[-- Attachment #1: Type: text/plain, Size: 148 bytes --]
On 10/3/22 13:37, Michael Albinus wrote:
> OK. Would you like to provide a patch? Including a ChangeLog-like commit
> message.
Is this okay?
-bjc
[-- Attachment #2: 0001-Provide-Podman-containers-on-their-own-method.patch --]
[-- Type: text/x-patch, Size: 3366 bytes --]
From 2273214c59794ca6fca59b08ed0f4b298520d307 Mon Sep 17 00:00:00 2001
From: Brian Cully <bjc@kublai.com>
Date: Tue, 4 Oct 2022 09:57:35 -0400
Subject: [PATCH] Provide Podman containers on their own method.
* 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/tramp-docker.el | 39 ++++++++++++++++++++++++++++++++++-----
1 file changed, 34 insertions(+), 5 deletions(-)
diff --git a/lisp/tramp-docker.el b/lisp/tramp-docker.el
index 12fabfe7..e7657414 100644
--- a/lisp/tramp-docker.el
+++ b/lisp/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."
@@ -89,9 +104,23 @@ see its function help for a description of the format."
(tramp-remote-shell-login ("-l"))
(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
--
2.37.3
^ permalink raw reply related [flat|nested] 14+ messages in thread
* Re: master 152c7322c1: * lisp/net/tramp-docker.el: New file.
2022-10-04 15:32 ` Brian Cully via Emacs development discussions.
@ 2022-10-04 16:58 ` Michael Albinus
2022-10-04 17:43 ` Brian Cully via Emacs development discussions.
0 siblings, 1 reply; 14+ messages in thread
From: Michael Albinus @ 2022-10-04 16:58 UTC (permalink / raw)
To: Brian Cully; +Cc: miha, Brian Cully, emacs-devel
Brian Cully <bjc@spork.org> writes:
Hi Brian,
>> OK. Would you like to provide a patch? Including a ChangeLog-like commit
>> message.
>
> Is this okay?
Thanks, I've pushed it almost unchanged to the repositories.
Could you pls send also some few words about podman for tramp.texi?
> -bjc
Best regards, Michael.
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: master 152c7322c1: * lisp/net/tramp-docker.el: New file.
2022-10-04 16:58 ` Michael Albinus
@ 2022-10-04 17:43 ` Brian Cully via Emacs development discussions.
2022-10-04 18:00 ` Michael Albinus
0 siblings, 1 reply; 14+ messages in thread
From: Brian Cully via Emacs development discussions. @ 2022-10-04 17:43 UTC (permalink / raw)
To: Michael Albinus; +Cc: miha, Brian Cully, emacs-devel
[-- Attachment #1: Type: text/plain, Size: 253 bytes --]
On 10/4/22 12:58, Michael Albinus wrote:
> Could you pls send also some few words about podman for tramp.texi?
This is just a copy of the Docker docs, but s/docker/podman/. I'm not
really all that familiar with texinfo, so I hope this is okay.
-bjc
[-- Attachment #2: 0001-Add-method-description-for-podman.patch --]
[-- Type: text/x-patch, Size: 1008 bytes --]
From 033128397bdc6ee0b9d9d85c008e823b9d9395aa Mon Sep 17 00:00:00 2001
From: Brian Cully <bjc@kublai.com>
Date: Tue, 4 Oct 2022 13:37:54 -0400
Subject: [PATCH] Add method description for podman.
* tramp.texi (Inline methods): describe podman method.
---
texi/tramp.texi | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/texi/tramp.texi b/texi/tramp.texi
index 5cb2cf80..94bf446e 100644
--- a/texi/tramp.texi
+++ b/texi/tramp.texi
@@ -912,6 +912,15 @@ Integration for Docker containers. A container is accessed via
@samp{user} is the (optional) user that you want to use, and
@samp{container} is the id or name of the container.
+@item @option{podman}
+@cindex method @option{podman}
+@cindex @option{podman} method
+
+Integration for Podman containers. A container is accessed via
+@file{@trampfn{podman,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
--
2.37.3
^ permalink raw reply related [flat|nested] 14+ messages in thread
* Re: master 152c7322c1: * lisp/net/tramp-docker.el: New file.
2022-10-04 17:43 ` Brian Cully via Emacs development discussions.
@ 2022-10-04 18:00 ` Michael Albinus
2022-10-04 18:17 ` Brian Cully via Emacs development discussions.
0 siblings, 1 reply; 14+ messages in thread
From: Michael Albinus @ 2022-10-04 18:00 UTC (permalink / raw)
To: Brian Cully; +Cc: miha, Brian Cully, emacs-devel
Brian Cully <bjc@spork.org> writes:
Hi Brian,
> This is just a copy of the Docker docs, but s/docker/podman/. I'm not
> really all that familiar with texinfo, so I hope this is okay.
I like to phrase the description for every method a little bit
different. What about
--8<---------------cut here---------------start------------->8---
Podman is a drop-in replacement for docker. It runs rootless. A
container is accessed via
@file{@trampfn{podman,user@@container,/path/to/file}}, where
@samp{user} is the (optional) user that you want to use, and
@samp{container} is the name or id of the container.
--8<---------------cut here---------------end--------------->8---
> -bjc
Best regards, Michael.
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: master 152c7322c1: * lisp/net/tramp-docker.el: New file.
2022-10-04 18:00 ` Michael Albinus
@ 2022-10-04 18:17 ` Brian Cully via Emacs development discussions.
2022-10-04 18:20 ` Michael Albinus
0 siblings, 1 reply; 14+ messages in thread
From: Brian Cully via Emacs development discussions. @ 2022-10-04 18:17 UTC (permalink / raw)
To: Michael Albinus; +Cc: miha, Brian Cully, emacs-devel
On 10/4/22 14:00, Michael Albinus wrote:
> Brian Cully <bjc@spork.org> writes:
>
> Hi Brian,
>
>> This is just a copy of the Docker docs, but s/docker/podman/. I'm not
>> really all that familiar with texinfo, so I hope this is okay.
>
> I like to phrase the description for every method a little bit
> different. What about
>
> --8<---------------cut here---------------start------------->8---
> Podman is a drop-in replacement for docker. It runs rootless. A
> container is accessed via
> @file{@trampfn{podman,user@@container,/path/to/file}}, where
> @samp{user} is the (optional) user that you want to use, and
> @samp{container} is the name or id of the container.
> --8<---------------cut here---------------end--------------->8---
>
>> -bjc
>
> Best regards, Michael.
Podman is not always run rootless (I cannot, for instance, because my
file system doesn't support openat2(2), which podman requires for
rootless containers).
What about:
-[snip]-
Podman is a docker alternative which may be run rootless, if desired.
Files are accessed via …
-[snip]-
It also looks like only the "docker" and "tramp" methods have examples
given of their file names. Should those parts be removed?
-bjc
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: master 152c7322c1: * lisp/net/tramp-docker.el: New file.
2022-10-04 18:17 ` Brian Cully via Emacs development discussions.
@ 2022-10-04 18:20 ` Michael Albinus
2022-10-04 18:33 ` Brian Cully via Emacs development discussions.
0 siblings, 1 reply; 14+ messages in thread
From: Michael Albinus @ 2022-10-04 18:20 UTC (permalink / raw)
To: Brian Cully; +Cc: miha, Brian Cully, emacs-devel
Brian Cully <bjc@spork.org> writes:
Hi Brian,
> What about:
>
> -[snip]-
> Podman is a docker alternative which may be run rootless, if
> desired. Files are accessed via …
> -[snip]-
Sounds OK.
> It also looks like only the "docker" and "tramp" methods have examples
> given of their file names. Should those parts be removed?
Oops, yes. This is senseless, because it is just the general
syntax. Could you pls provide another patch for both the docker and the
podman entries?
> -bjc
Thanks, and best regards, Michael.
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: master 152c7322c1: * lisp/net/tramp-docker.el: New file.
2022-10-04 18:20 ` Michael Albinus
@ 2022-10-04 18:33 ` Brian Cully via Emacs development discussions.
2022-10-04 18:36 ` Michael Albinus
0 siblings, 1 reply; 14+ messages in thread
From: Brian Cully via Emacs development discussions. @ 2022-10-04 18:33 UTC (permalink / raw)
To: Michael Albinus; +Cc: miha, Brian Cully, emacs-devel
[-- Attachment #1: Type: text/plain, Size: 216 bytes --]
On 10/4/22 14:20, Michael Albinus wrote:
> Oops, yes. This is senseless, because it is just the general
> syntax. Could you pls provide another patch for both the docker and the
> podman entries?
See attached.
-bjc
[-- Attachment #2: v2-0001-Add-method-description-for-podman.patch --]
[-- Type: text/x-patch, Size: 1046 bytes --]
From d7882f40a4366b7c07874b9a39e44723a5d92c6e Mon Sep 17 00:00:00 2001
From: Brian Cully <bjc@kublai.com>
Date: Tue, 4 Oct 2022 13:37:54 -0400
Subject: [PATCH v2] Add method description for podman.
* tramp.texi (Inline methods): describe podman method.
---
texi/tramp.texi | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
diff --git a/texi/tramp.texi b/texi/tramp.texi
index 5cb2cf80..d0124d1c 100644
--- a/texi/tramp.texi
+++ b/texi/tramp.texi
@@ -907,10 +907,14 @@ session.
@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.
+Integration for Docker containers.
+
+@item @option{podman}
+@cindex method @option{podman}
+@cindex @option{podman} method
+
+Podman is an alternative to @option{docker} which may be run rootless,
+if desired.
@end table
--
2.37.3
^ permalink raw reply related [flat|nested] 14+ messages in thread
* Re: master 152c7322c1: * lisp/net/tramp-docker.el: New file.
2022-10-04 18:33 ` Brian Cully via Emacs development discussions.
@ 2022-10-04 18:36 ` Michael Albinus
2022-10-04 18:45 ` Brian Cully via Emacs development discussions.
0 siblings, 1 reply; 14+ messages in thread
From: Michael Albinus @ 2022-10-04 18:36 UTC (permalink / raw)
To: Brian Cully; +Cc: miha, Brian Cully, emacs-devel
Brian Cully <bjc@spork.org> writes:
Hi Brian,
>> Oops, yes. This is senseless, because it is just the general
>> syntax. Could you pls provide another patch for both the docker and the
>> podman entries?
> See attached.
Thanks. But shouldn't we say at least, that the container's name or id
is used as Tramp's host name?
> -bjc
Best regards, Michael.
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: master 152c7322c1: * lisp/net/tramp-docker.el: New file.
2022-10-04 18:36 ` Michael Albinus
@ 2022-10-04 18:45 ` Brian Cully via Emacs development discussions.
2022-10-04 19:21 ` Michael Albinus
0 siblings, 1 reply; 14+ messages in thread
From: Brian Cully via Emacs development discussions. @ 2022-10-04 18:45 UTC (permalink / raw)
To: Michael Albinus; +Cc: miha, Brian Cully, emacs-devel
[-- Attachment #1: Type: text/plain, Size: 172 bytes --]
On 10/4/22 14:36, Michael Albinus wrote:
> Thanks. But shouldn't we say at least, that the container's name or id
> is used as Tramp's host name?
Seems reasonable.
-bjc
[-- Attachment #2: v3-0001-Add-method-description-for-podman.patch --]
[-- Type: text/x-patch, Size: 1139 bytes --]
From a3ea6518259aa6128b2a726cfe2fcff9f4c56141 Mon Sep 17 00:00:00 2001
From: Brian Cully <bjc@kublai.com>
Date: Tue, 4 Oct 2022 13:37:54 -0400
Subject: [PATCH v3] Add method description for podman.
* tramp.texi (Inline methods): describe podman method.
---
texi/tramp.texi | 13 +++++++++----
1 file changed, 9 insertions(+), 4 deletions(-)
diff --git a/texi/tramp.texi b/texi/tramp.texi
index 5cb2cf80..ce3a48a2 100644
--- a/texi/tramp.texi
+++ b/texi/tramp.texi
@@ -907,10 +907,15 @@ session.
@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.
+Integration for Docker containers. The host may be either a running
+container's name or ID, as returned by @samp{docker ps}.
+
+@item @option{podman}
+@cindex method @option{podman}
+@cindex @option{podman} method
+
+Podman is an alternative to @option{docker} which may be run rootless,
+if desired.
@end table
--
2.37.3
^ permalink raw reply related [flat|nested] 14+ messages in thread
* Re: master 152c7322c1: * lisp/net/tramp-docker.el: New file.
2022-10-04 18:45 ` Brian Cully via Emacs development discussions.
@ 2022-10-04 19:21 ` Michael Albinus
0 siblings, 0 replies; 14+ messages in thread
From: Michael Albinus @ 2022-10-04 19:21 UTC (permalink / raw)
To: Brian Cully; +Cc: miha, Brian Cully, emacs-devel
Brian Cully <bjc@spork.org> writes:
Hi Brian,
>> Thanks. But shouldn't we say at least, that the container's name or id
>> is used as Tramp's host name?
>
> Seems reasonable.
Thanks for the patch, I've pushed it (slightly modified).
> -bjc
Best regards, Michael.
^ permalink raw reply [flat|nested] 14+ messages in thread
end of thread, other threads:[~2022-10-04 19:21 UTC | newest]
Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-09-29 16:50 master 152c7322c1: * lisp/net/tramp-docker.el: New file miha
2022-09-29 17:28 ` Michael Albinus
2022-10-03 13:44 ` Brian Cully via Emacs development discussions.
2022-10-03 17:37 ` Michael Albinus
2022-10-04 15:32 ` Brian Cully via Emacs development discussions.
2022-10-04 16:58 ` Michael Albinus
2022-10-04 17:43 ` Brian Cully via Emacs development discussions.
2022-10-04 18:00 ` Michael Albinus
2022-10-04 18:17 ` Brian Cully via Emacs development discussions.
2022-10-04 18:20 ` Michael Albinus
2022-10-04 18:33 ` Brian Cully via Emacs development discussions.
2022-10-04 18:36 ` Michael Albinus
2022-10-04 18:45 ` Brian Cully via Emacs development discussions.
2022-10-04 19:21 ` Michael Albinus
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).