Support specifying a user for accessing the file system in a Docker container
Hi @Silex, I appreciate the docker mode for Emacs very much.
I only found that in some of our docker images, we are using different user IDs and some parts of the file system have restricted permissions depending on the resp. user.
It would be great if the docker mode could allow specifying a user for accessing the file system inside a Docker container.
I have already found a solution, replacing docker-container-find-directory-selection, see below.
If you prefer, then I am happy to create a pull request.
(defvar docker-container-user-history nil)
(defun user-at-host (host user)
(if (or (not user) (string= user ""))
host (concat user "@" host)))
(defun docker-container-find-directory-selection (user path)
"Run `docker-container-find-directory' for PATH on the containers selection."
(interactive
(let ((user (read-from-minibuffer
"User: " nil nil nil 'docker-container-user-history))
(path (read-from-minibuffer "Path: ")))
(list user path)))
(docker-utils-ensure-items)
(--each (docker-utils-get-marked-items-ids)
(docker-container-find-directory (user-at-host it user) path)))
Hum, good idea you could even modify https://github.com/Silex/docker.el/blob/main/docker-container.el#L445-L449 so you can specify the user in the transient.
PR welcome 😉