0

I start a container with name pg.I wanted to debug a bash script in a container, so I installed bashdb in the container. I started it:

root@f8693085f270:/# /usr/share/bin/bashdb docker-entrypoint.sh postgres

I go back to the host, and do:

[eric@almond volume]$ docker exec -ti pg bash
root@f8693085f270:/# ps ajxw
 PPID   PID  PGID   SID TTY      TPGID STAT   UID   TIME COMMAND
    0     1     1     1 ?         3746 Ss       0   0:00 bash
    1  3746  3746     1 console   3746 S+       0   0:00 /bin/bash 

[eric@almond postgres]$ ps ajxw | grep docker
30613  3702  3702 30613 pts/36    3702 Sl+   1000   0:01 docker run --name pg -v /home/eric/tmp/bashdb:/bashdb -it postgres bash
 3760  8049  8049  3760 pts/19    8049 S+       0   0:00 /bin/bash /usr/share/bin/bashdb docker-entrypoint.sh postgres
 4166  8294  8294  4166 pts/9     8294 Sl+   1000   0:00 docker exec -ti pg bash

So in the container I see a TTY entry console, which I have never seen before, and I see the debugging entry in ps on the host!

What is going on?

rocky
  • 7,226
  • 3
  • 33
  • 74
ericj
  • 2,138
  • 27
  • 44
  • You may try to read https://docs.docker.com/engine/reference/commandline/top/ about the "docker top [CONTAINER]" command. This command will display the running processes of a container on the host. You can use it to get the process of container easier – paco alcacer Aug 10 '16 at 14:36

1 Answers1

0

Docker isolates a container from the host, it doesn't isolate the host from the container. That means the host can see the processes run inside containers, though from a different name space so the pids will be different.

Attaching to console appears to be something from bashdb. It has automatic detection for the tty to direct output to, and may be getting thrown off by the Docker isolation.

BMitch
  • 231,797
  • 42
  • 475
  • 450