I also thought I'd see what would happen using emacs 28 and the unofficial docker-tramp package from https://melpa.org/#/docker-tramp
It seems to work as expected for both the haskell and alpine container. The haskell one: /docker:4a3b345bbb1c:/root $ sh -c 'whoami' root The alpine one: /docker:a1c9a2986ae9:/root $ sh -c 'whoami' root