Docker
Entrypoint and CMD
Each commands executed in ENTRYPOINT and CMD has a PID 1. For instance:
FROM ubuntu
# ENTRYPOINT ["/bin/sleep", "120"]
CMD ["/bin/sleep", "60"]
And we build the Docker and execute it:
$ docker build -t test .
Sending build context to Docker daemon 2.048kB
Step 1/2 : FROM ubuntu
---> 602eb6fb314b
Step 2/2 : CMD ["/bin/sleep", "60"]
---> Using cache
---> a647c5903c6c
Successfully built a647c5903c6c
Successfully tagged test:latest
$ docker run test &
$ docker exec -it e1584c04298c bash
root@e1584c04298c:/# ps auxf
USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
root 8 1.2 0.0 4588 3912 pts/0 Ss 14:56 0:00 bash
root 16 0.0 0.0 7888 3964 pts/0 R+ 14:56 0:00 \_ ps auxf
root 1 0.0 0.0 2696 1072 ? Ss 14:55 0:00 /bin/sleep 60