Terminating the Main Process of a Container
Learn how to manage a container by terminating its main process, restarting the container, attaching to its shell, and exiting the container without stopping it.
We'll cover the following...
Earlier in the chapter, we learned that containers are designed to run a single process, and terminating this process also terminates the container. Let’s test if that’s true.
Run the following command to start a new interactive container named ddd-ctr
based on the Ubuntu image, specifying Bash as its main process.
$ docker run --name ddd-ctr -it ubuntu:24.04 bashUnable to find image 'ubuntu:24.04' locally24.04: Pulling from library/ubuntu51ae9e2de052: Download completeDigest: sha256:ff0b5139e774bb0dee9ca8b572b4d69eaec2795deb8dc47c8c829becd67de41eStatus: Downloaded newer image for ubuntu:24.04root@d3c892ad0eb3:/#
Start a new interactive container called ddd-ctr
...
Access this course and 1400+ top-rated courses and projects.