Managing the Container Lifecycle

Let’s take a look at the typical container lifecycle events like stopping, restarting, and deleting a container and how they affect the changes we make to the container.

Modifying files within a container

In this lesson, we’ll exec onto the webserver container and edit the web server configuration to display a new message on the home page. You’ll also stop and restart the container and verify your changes aren’t lost.

WARNING: This lesson is for demonstration purposes only. In the real world, you shouldn’t change live containers like this. Any time you need to change a live container, you should create and test a new container with the required changes and then replace the existing container with the new one.

Open a new interactive exec session to the webserver container with the following command.

Get hands-on with 1400+ tech skills courses.