0

I run a Cisco XRd docker container on my Linux Ubuntu host. I run the image using docker run -it -d command. The image's entrypoint is /usr/sbin/init, indeed:

root@eve-ng-6:/opt/unetlab/html# docker ps
CONTAINER ID   IMAGE                             COMMAND            CREATED        STATUS       PORTS     NAMES
2ed1b2e66197   ios-xr/xrd-control-plane:latest   "/usr/sbin/init"   20 hours ago   Up 3 hours             75bc86e8-108a-4300-863a-2141b5718b55-0-2
root@eve-ng-6:/opt/unetlab/html#

Then by using docker attach, I can attach to the running docker container.

Af far as I understand, see Comparing Docker Exec and Docker Attach, docker attach does not start any new process within the container but simply attaches the current terminal to the stdin/stdout/stderr of the container's primary process (i.e. to the process running the image's entrypoint). In my case it is /usr/sbin/init from Cisco XRd.

My question: is the /usr/sbin/init process that is actually "talking" with the user (me) by reading and writing to the attached pseudo-terminal ?

P.s. note that a pseudo-terminal is allocated by virtue of the -d option in docker run command.

2
  • 1
    I think you're assuming that the docker ps output's COMMAND field is the actively running process that the docker attach command connects you to. As the answers and comments in this SO question say, that's not necessarily the case. The entrypoint command may be only short-lived, replaced by another program/command it launches. Ot it can be long-lived. It depends on the software in the container image. Commented May 31 at 7:24
  • Ah ok, the docker ps output's COMMAND field is the name of the command when the container was started. Later, upon docker attaching to it, the actual program/executable docker attach attaches to may be different from that. Commented May 31 at 11:36

0

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.