Killing a Container’s Main Process

Learn how to manage a container by terminating its main process, how to then restart the container and attach it to the shell, and how to exit a container without killing it.

Earlier in the chapter, we learned that containers are designed to run a single process, and killing this process also kills the container. Let’s test if that’s true. Run the following command to start a new interactive container called ddd-ctr based on the Ubuntu image and tell it to run a Bash shell as its main process.

Get hands-on with 1400+ tech skills courses.