tramp-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: sh -c 'whoami' gives permission error in docker container and puts m


From: ParetoOptimalDev
Subject: Re: sh -c 'whoami' gives permission error in docker container and puts me in weird prompt/subshell
Date: Wed, 05 Apr 2023 10:46:02 -0500
User-agent: Gnus/5.13 (Gnus v5.13)

Michael Albinus <michael.albinus@gmx.de> writes:

> That's not the whole story. How did you start container alpine3173?

Sorry, I had a feeling I should repaste that part as well.

This should
work from any machine with docker and emacs 29+. Reminder that I'm using
emacs 30.0.50.

Also note I'm executing these steps and pasting them as I verify they are valid
from `emacs -Q` with emacs 30.0.50.

1. Start `emacs -Q`

2. Start the alpine docker container using a specific tag by evaluating:

(async-shell-command "docker run --name alpine3173 --rm -it alpine:3.17.3 sh" 
"*docker run alpine sh*")

3. open dired in the alpine container

C-x C-f /docker:root@alpine3173: RET

4. Open eshell with M-x eshell

5. Try to run any command that eshell does not implement which exists in
the docker container's PATH.

`chown` for instance:

Welcome to the Emacs shell

/docker:root@alpine3173:~ # chown
‘echo \"`uname -sr`\"’ does not return a valid Lisp expression: ‘sh: uname: 
command not found
""
’

After writing those all out, I followed them again and reproduced this
issue successfully.

Some potentially useful debugging information from that point:

```
/docker:root@alpine3173:~ # ls -larth /docker:root@alpine3173:/bin/uname
lrwxrwxrwx   1 root           root           12 1969-12-31  1969 
/docker:root@alpine3173:/bin/uname -> /bin/busybox
/docker:root@alpine3173:~ # ls -larth /docker:root@alpine3173:/bin/sh
lrwxrwxrwx   1 root           root           12 1969-12-31  1969 
/docker:root@alpine3173:/bin/sh -> /bin/busybox
/docker:root@alpine3173:~ # echo $PATH
/bin:/usr/bin:/sbin:/usr/sbin:/usr/local/bin
/docker:root@alpine3173:~ # whoami
root
/docker:root@alpine3173:~ # which whoami
eshell/whoami is a native-compiled Lisp function in ‘em-unix.el’.
```








reply via email to

[Prev in Thread] Current Thread [Next in Thread]