1

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
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

phoxd
  • 231
  • 1
  • 7

2 Answers2

1

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.

wasamasa
  • 21,803
  • 1
  • 65
  • 97
0

Use cd instead of docker attach. So, at the eshell prompt, instead of attaching to a running container with

$ docker attach  <container_id>

cd into it with

$ cd /docker:<container_id>:/

You'll get the full eshell experience with this method.

mihai
  • 321
  • 2
  • 12