Bear with me here, still learning about tramp and how to debug it. Here is a proper backtrace that shows the error source seems to be `tramp-signal-hook-function(wrong-type-argument (stringp nil))`:
17:42:13.200213 tramp-send-command-and-read (10) # backtrace() tramp-error((tramp-file-name "docker" nil nil "alpine3173" nil nil nil) wrong-type-argument "stringp nil") tramp-signal-hook-function(wrong-type-argument (stringp nil)) format-message(nil) error(nil) #<subr tramp-send-command-and-read>((tramp-file-name "docker" nil nil "alpine3173" nil nil nil) "echo \\\"`tty`\\\"" noerror nil) apply(#<subr tramp-send-command-and-read> ((tramp-file-name "docker" nil nil "alpine3173" nil nil nil) "echo \\\"`tty`\\\"" noerror)) #f(compiled-function (body &rest args) #<bytecode -0x128bf47dd1477011>)(#<subr tramp-send-command-and-read> (tramp-file-name "docker" nil nil "alpine3173" nil nil nil) "echo \\\"`tty`\\\"" noerror) apply(#f(compiled-function (body &rest args) #<bytecode -0x128bf47dd1477011>) #<subr tramp-send-command-and-read> ((tramp-file-name "docker" nil nil "alpine3173" nil nil nil) "echo \\\"`tty`\\\"" noerror)) tramp-send-command-and-read((tramp-file-name "docker" nil nil "alpine3173" nil nil nil) "echo \\\"`tty`\\\"" noerror) #<subr tramp-open-connection-setup-interactive-shell>(#<process sh> (tramp-file-name "docker" nil nil "alpine3173" nil nil nil)) apply(#<subr tramp-open-connection-setup-interactive-shell> (#<process sh> (tramp-file-name "docker" nil nil "alpine3173" nil nil nil))) #f(compiled-function (body &rest args) #<bytecode -0x128bf710c86f7011>)(#<subr tramp-open-connection-setup-interactive-shell> #<process sh> (tramp-file-name "docker" nil nil "alpine3173" nil nil nil)) apply(#f(compiled-function (body &rest args) #<bytecode -0x128bf710c86f7011>) #<subr tramp-open-connection-setup-interactive-shell> (#<process sh> (tramp-file-name "docker" nil nil "alpine3173" nil nil nil))) tramp-open-connection-setup-interactive-shell(#<process sh> (tramp-file-name "docker" nil nil "alpine3173" nil nil nil)) #<subr tramp-maybe-open-connection>((tramp-file-name "docker" nil nil "alpine3173" nil nil nil)) apply(#<subr tramp-maybe-open-connection> (tramp-file-name "docker" nil nil "alpine3173" nil nil nil)) #f(compiled-function (body &rest args) #<bytecode -0x128bf710af577011>)(#<subr tramp-maybe-open-connection> (tramp-file-name "docker" nil nil "alpine3173" nil nil nil)) apply(#f(compiled-function (body &rest args) #<bytecode -0x128bf710af577011>) #<subr tramp-maybe-open-connection> (tramp-file-name "docker" nil nil "alpine3173" nil nil nil)) tramp-maybe-open-connection((tramp-file-name "docker" nil nil "alpine3173" nil nil nil)) #<subr tramp-send-command>((tramp-file-name "docker" nil nil "alpine3173" nil nil nil) "echo $$ 2>/dev/null; echo tramp_exit_status $?" nil nil) apply(#<subr tramp-send-command> ((tramp-file-name "docker" nil nil "alpine3173" nil nil nil) "echo $$ 2>/dev/null; echo tramp_exit_status $?")) #f(compiled-function (body &rest args) #<bytecode -0x128bf513bf137011>)(#<subr tramp-send-command> (tramp-file-name "docker" nil nil "alpine3173" nil nil nil) "echo $$ 2>/dev/null; echo tramp_exit_status $?") apply(#f(compiled-function (body &rest args) #<bytecode -0x128bf513bf137011>) #<subr tramp-send-command> ((tramp-file-name "docker" nil nil "alpine3173" nil nil nil) "echo $$ 2>/dev/null; echo tramp_exit_status $?")) tramp-send-command((tramp-file-name "docker" nil nil "alpine3173" nil nil nil) "echo $$ 2>/dev/null; echo tramp_exit_status $?") #<subr tramp-send-command-and-check>((tramp-file-name "docker" nil nil "alpine3173" nil nil nil) "echo $$" nil nil nil) apply(#<subr tramp-send-command-and-check> ((tramp-file-name "docker" nil nil "alpine3173" nil nil nil) "echo $$")) #f(compiled-function (body &rest args) #<bytecode -0x128bfa65754b7011>)(#<subr tramp-send-command-and-check> (tramp-file-name "docker" nil nil "alpine3173" nil nil nil) "echo $$") apply(#f(compiled-function (body &rest args) #<bytecode -0x128bfa65754b7011>) #<subr tramp-send-command-and-check> ((tramp-file-name "docker" nil nil "alpine3173" nil nil nil) "echo $$")) tramp-send-command-and-check((tramp-file-name "docker" nil nil "alpine3173" nil nil nil) "echo $$") #<subr tramp-barf-unless-okay>((tramp-file-name "docker" nil nil "alpine3173" nil nil nil) "echo $$" "`%s' returns with error" "echo $$") apply(#<subr tramp-barf-unless-okay> ((tramp-file-name "docker" nil nil "alpine3173" nil nil nil) "echo $$" "`%s' returns with error" "echo $$")) #f(compiled-function (body &rest args) #<bytecode -0x128bf47dcb2f7011>)(#<subr tramp-barf-unless-okay> (tramp-file-name "docker" nil nil "alpine3173" nil nil nil) "echo $$" "`%s' returns with error" "echo $$") apply(#f(compiled-function (body &rest args) #<bytecode -0x128bf47dcb2f7011>) #<subr tramp-barf-unless-okay> ((tramp-file-name "docker" nil nil "alpine3173" nil nil nil) "echo $$" "`%s' returns with error" "echo $$")) tramp-barf-unless-okay((tramp-file-name "docker" nil nil "alpine3173" nil nil nil) "echo $$" "`%s' returns with error" "echo $$") #<subr tramp-send-command-and-read>((tramp-file-name "docker" nil nil "alpine3173" nil nil nil) "echo $$" nil nil) apply(#<subr tramp-send-command-and-read> ((tramp-file-name "docker" nil nil "alpine3173" nil nil nil) "echo $$")) #f(compiled-function (body &rest args) #<bytecode -0x128bf47dd1477011>)(#<subr tramp-send-command-and-read> (tramp-file-name "docker" nil nil "alpine3173" nil nil nil) "echo $$") apply(#f(compiled-function (body &rest args) #<bytecode -0x128bf47dd1477011>) #<subr tramp-send-command-and-read> ((tramp-file-name "docker" nil nil "alpine3173" nil nil nil) "echo $$")) tramp-send-command-and-read((tramp-file-name "docker" nil nil "alpine3173" nil nil nil) "echo $$") #<subr tramp-sh-handle-make-process>(:name "sh" :buffer #<buffer *eshell*> :command ("/bin/sh" "-c" #("whoami" 0 6 (escaped t))) :filter eshell-interactive-process-filter :sentinel eshell-sentinel :connection-type nil :stderr nil :file-handler t) apply(#<subr tramp-sh-handle-make-process> (:name "sh" :buffer #<buffer *eshell*> :command ("/bin/sh" "-c" #("whoami" 0 6 (escaped t))) :filter eshell-interactive-process-filter :sentinel eshell-sentinel :connection-type nil :stderr nil :file-handler t)) #f(compiled-function (body &rest args) #<bytecode -0x128bf7aef9377011>)(#<subr tramp-sh-handle-make-process> :name "sh" :buffer #<buffer *eshell*> :command ("/bin/sh" "-c" #("whoami" 0 6 (escaped t))) :filter eshell-interactive-process-filter :sentinel eshell-sentinel :connection-type nil :stderr nil :file-handler t) apply(#f(compiled-function (body &rest args) #<bytecode -0x128bf7aef9377011>) #<subr tramp-sh-handle-make-process> (:name "sh" :buffer #<buffer *eshell*> :command ("/bin/sh" "-c" #("whoami" 0 6 (escaped t))) :filter eshell-interactive-process-filter :sentinel eshell-sentinel :connection-type nil :stderr nil :file-handler t)) tramp-sh-handle-make-process(:name "sh" :buffer #<buffer *eshell*> :command ("/bin/sh" "-c" #("whoami" 0 6 (escaped t))) :filter eshell-interactive-process-filter :sentinel eshell-sentinel :connection-type nil :stderr nil :file-handler t) #<subr tramp-sh-file-name-handler>(make-process :name "sh" :buffer #<buffer *eshell*> :command ("/bin/sh" "-c" #("whoami" 0 6 (escaped t))) :filter eshell-interactive-process-filter :sentinel eshell-sentinel :connection-type nil :stderr nil :file-handler t) apply(#<subr tramp-sh-file-name-handler> (make-process :name "sh" :buffer #<buffer *eshell*> :command ("/bin/sh" "-c" #("whoami" 0 6 (escaped t))) :filter eshell-interactive-process-filter :sentinel eshell-sentinel :connection-type nil :stderr nil :file-handler t)) #f(compiled-function (body &rest args) #<bytecode -0x128bf7aec0837011>)(#<subr tramp-sh-file-name-handler> make-process :name "sh" :buffer #<buffer *eshell*> :command ("/bin/sh" "-c" #("whoami" 0 6 (escaped t))) :filter eshell-interactive-process-filter :sentinel eshell-sentinel :connection-type nil :stderr nil :file-handler t) apply(#f(compiled-function (body &rest args) #<bytecode -0x128bf7aec0837011>) #<subr tramp-sh-file-name-handler> (make-process :name "sh" :buffer #<buffer *eshell*> :command ("/bin/sh" "-c" #("whoami" 0 6 (escaped t))) :filter eshell-interactive-process-filter :sentinel eshell-sentinel :connection-type nil :stderr nil :file-handler t)) tramp-sh-file-name-handler(make-process :name "sh" :buffer #<buffer *eshell*> :command ("/bin/sh" "-c" #("whoami" 0 6 (escaped t))) :filter eshell-interactive-process-filter :sentinel eshell-sentinel :connection-type nil :stderr nil :file-handler t) apply(tramp-sh-file-name-handler make-process (:name "sh" :buffer #<buffer *eshell*> :command ("/bin/sh" "-c" #("whoami" 0 6 (escaped t))) :filter eshell-interactive-process-filter :sentinel eshell-sentinel :connection-type nil :stderr nil :file-handler t)) #<subr tramp-file-name-handler>(make-process :name "sh" :buffer #<buffer *eshell*> :command ("/bin/sh" "-c" #("whoami" 0 6 (escaped t))) :filter eshell-interactive-process-filter :sentinel eshell-sentinel :connection-type nil :stderr nil :file-handler t) apply(#<subr tramp-file-name-handler> (make-process :name "sh" :buffer #<buffer *eshell*> :command ("/bin/sh" "-c" #("whoami" 0 6 (escaped t))) :filter eshell-interactive-process-filter :sentinel eshell-sentinel :connection-type nil :stderr nil :file-handler t)) #f(compiled-function (body &rest args) #<bytecode 0xd0ec2f587d08fec>)(#<subr tramp-file-name-handler> make-process :name "sh" :buffer #<buffer *eshell*> :command ("/bin/sh" "-c" #("whoami" 0 6 (escaped t))) :filter eshell-interactive-process-filter :sentinel eshell-sentinel :connection-type nil :stderr nil :file-handler t) apply(#f(compiled-function (body &rest args) #<bytecode 0xd0ec2f587d08fec>) #<subr tramp-file-name-handler> (make-process :name "sh" :buffer #<buffer *eshell*> :command ("/bin/sh" "-c" #("whoami" 0 6 (escaped t))) :filter eshell-interactive-process-filter :sentinel eshell-sentinel :connection-type nil :stderr nil :file-handler t)) tramp-file-name-handler(make-process :name "sh" :buffer #<buffer *eshell*> :command ("/bin/sh" "-c" #("whoami" 0 6 (escaped t))) :filter eshell-interactive-process-filter :sentinel eshell-sentinel :connection-type nil :stderr nil :file-handler t) eshell-gather-process-output("/docker:alpine3173://bin/sh" ("-c" #("whoami" 0 6 (escaped t)))) eshell-external-command("sh" ("-c" #("whoami" 0 6 (escaped t)))) eshell-plain-command("sh" ("-c" #("whoami" 0 6 (escaped t)))) eshell-named-command("sh" ("-c" #("whoami" 0 6 (escaped t)))) eval((eshell-named-command '"sh" '("-c" #("whoami" 0 6 (escaped t))))) eshell-do-eval((eshell-named-command '"sh" '("-c" #("whoami" 0 6 (escaped t)))) nil) eshell-do-eval((prog1 (eshell-named-command '"sh" '("-c" #("whoami" 0 6 (escaped t)))) (mapc #'funcall eshell-this-command-hook)) nil) (condition-case err (eshell-do-eval '(prog1 (eshell-named-command '"sh" '("-c" #("whoami" 0 6 ...))) (mapc #'funcall eshell-this-command-hook)) nil) ((debug error) (mapc #'funcall eshell-this-command-hook) (eshell-errorn (error-message-string err)) (eshell-close-handles 1))) eval((condition-case err (eshell-do-eval '(prog1 (eshell-named-command '"sh" '("-c" ...)) (mapc #'funcall eshell-this-command-hook)) nil) ((debug error) (mapc #'funcall eshell-this-command-hook) (eshell-errorn (error-message-string err)) (eshell-close-handles 1)))) eshell-do-eval((condition-case err (eshell-do-eval '(prog1 (eshell-named-command '"sh" '("-c" ...)) (mapc #'funcall eshell-this-command-hook)) nil) ((debug error) (mapc #'funcall eshell-this-command-hook) (eshell-errorn (error-message-string err)) (eshell-close-handles 1))) nil) #f(compiled-function () #<bytecode 0x1c62a7ab417757e1>)() funcall(#f(compiled-function () #<bytecode 0x1c62a7ab417757e1>)) (let ((eshell-this-command-hook '(ignore))) (funcall '#f(compiled-function () #<bytecode 0x1c62a7ab417757e1>))) eval((let ((eshell-this-command-hook '(ignore))) (funcall '#f(compiled-function () #<bytecode 0x1c62a7ab417757e1>)))) eshell-do-eval((let ((eshell-this-command-hook '(ignore))) (condition-case err (eshell-do-eval '(prog1 (eshell-named-command '"sh" '...) (mapc #'funcall eshell-this-command-hook)) nil) ((debug error) (mapc #'funcall eshell-this-command-hook) (eshell-errorn (error-message-string err)) (eshell-close-handles 1)))) nil) #f(compiled-function () #<bytecode 0x1c62a7ab417757e1>)() funcall(#f(compiled-function () #<bytecode 0x1c62a7ab417757e1>)) (let ((eshell-current-handles '[nil (((t) . 2) t) (((t) . 2) t)])) (funcall '#f(compiled-function () #<bytecode 0x1c62a7ab417757e1>))) eval((let ((eshell-current-handles '[nil ((... . 2) t) ((... . 2) t)])) (funcall '#f(compiled-function () #<bytecode 0x1c62a7ab417757e1>)))) eshell-do-eval((let ((eshell-current-handles '[nil ((... . 2) t) ((... . 2) t)])) (let ((eshell-this-command-hook '(ignore))) (condition-case err (eshell-do-eval '(prog1 (eshell-named-command ... ...) (mapc ... eshell-this-command-hook)) nil) ((debug error) (mapc #'funcall eshell-this-command-hook) (eshell-errorn (error-message-string err)) (eshell-close-handles 1))))) nil) eshell-do-eval((progn (let ((eshell-current-handles '[nil (... t) (... t)])) (let ((eshell-this-command-hook '(ignore))) (condition-case err (eshell-do-eval '(prog1 ... ...) nil) ((debug error) (mapc #'funcall eshell-this-command-hook) (eshell-errorn (error-message-string err)) (eshell-close-handles 1)))))) nil) (catch 'top-level (eshell-do-eval '(progn (let ((eshell-current-handles '...)) (let ((eshell-this-command-hook ...)) (condition-case err (eshell-do-eval ... nil) (... ... ... ...))))) nil)) eval((catch 'top-level (eshell-do-eval '(progn (let ((eshell-current-handles ...)) (let (...) (condition-case err ... ...)))) nil))) eshell-do-eval((catch 'top-level (eshell-do-eval '(progn (let ((eshell-current-handles ...)) (let (...) (condition-case err ... ...)))) nil)) nil) eshell-do-eval((progn 'nil (catch 'top-level (eshell-do-eval '(progn (let (...) (let ... ...))) nil)) (run-hooks 'eshell-post-command-hook)) nil) #f(compiled-function () #<bytecode 0x1c62a7ab417757e1>)() funcall(#f(compiled-function () #<bytecode 0x1c62a7ab417757e1>)) (let ((eshell-current-handles '[nil (((t) . 2) t) (((t) . 2) t)]) (eshell-current-subjob-p 'nil)) (funcall '#f(compiled-function () #<bytecode 0x1c62a7ab417757e1>))) eval((let ((eshell-current-handles '[nil ((... . 2) t) ((... . 2) t)]) (eshell-current-subjob-p 'nil)) (funcall '#f(compiled-function () #<bytecode 0x1c62a7ab417757e1>)))) eshell-do-eval((let ((eshell-current-handles '[nil ((... . 2) t) ((... . 2) t)]) eshell-current-subjob-p) (progn 'nil (catch 'top-level (eshell-do-eval '(progn (let ... ...)) nil)) (run-hooks 'eshell-post-command-hook)))) eshell-resume-eval() eshell-eval-command((let ((eshell-current-handles '[nil ((... . 2) t) ((... . 2) t)]) eshell-current-subjob-p) (progn 'nil (catch 'top-level (eshell-do-eval '(progn (let ... ...)) nil)) (run-hooks 'eshell-post-command-hook))) "sh -c 'whoami'") eshell-send-input(nil) funcall-interactively(eshell-send-input nil) command-execute(eshell-send-input) 17:42:13.200734 tramp-send-command-and-read (1) # Wrong type argument: "Wrong type argument", "stringp nil"