I am running docker-compose up using the following command to set up my Docker containers:
sudo -E env PATH="$PATH" sh -c "docker-compose up"
When I check the processes using ps aux, I see the following hierarchy:
root 2505477 0.1 0.0 7916 3788 pts/4 S+ 06:46 0:00 sudo -E env PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin sh -c docker-compose up
root 2505480 0.0 0.0 7916 520 pts/5 Ss 06:46 0:00 sudo -E env PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin sh -c docker-compose up
root 2505481 0.0 0.0 2316 816 pts/5 S+ 06:46 0:00 sh -c docker-compose up
root 2505483 6.6 0.5 351976 48552 pts/5 Sl+ 06:46 0:00 /usr/bin/python3 /usr/bin/docker-compose up
And the process tree looks like this:
sudo(2505477)───sudo(2505480)───sh(2505481)───docker-compose(2505483)─┬─{docker-compose}(2505755)
├─{docker-compose}(2505756)
└─{docker-compose}(2505757)
When I attempt to stop the Docker containers by killing the shell process and the docker-compose process using:
sudo kill -15 2505481 2505483
The Docker containers do not stop. However, if I only target the docker-compose process with:
sudo kill -15 2505483
It does stop the containers. Why does killing both the sh process (2505481) and docker-compose process (2505483) not stop the Docker containers?
Any insights into what might be happening here would be greatly appreciated.