When I start emacs -q and run M-x shell there is formatting error when connecting to docker container as follows,

$ docker container exec -it b3c85fd9c5eaa2e64fc5aac9025d1f9c3b3fe47ca39008f40ddd436338d755f5 bash
]0;root@b3c85fd9c5ea: /root@b3c85fd9c5ea:/# ls
bin   dev  home  lib64  mnt  proc  run   srv  tmp  var
boot  etc  lib   media  opt  root  sbin  sys  usr
]0;root@b3c85fd9c5ea: /root@b3c85fd9c5ea:/# 

Here is its screenshot

enter image description here


Your value of PS1 contains ANSI escape codes that can only be processed correctly by a terminal emulator (like the built-in term.el or vterm), not by M-x shell or M-x eshell. Set it to something simpler like \u@\h:\w\$, this could be done with the -e switch for the docker-container-exec command.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.