Challenge, Medium,  on  Containers

Edit a File in a Running Container: a Slim Base Image Case

Premium Challenge

Upgrade your membership to unlock this and all other premium materials.

Upgrade

Similar to the previous challenge, you need to edit the index.html file of the running web server container:

  • Replace the phrase "Hello World" with the phrase "Hello Labs".
  • Add the phrase "Practice for the win!" to any place in the file.

However, this time, the container is based on a slim image, so there is no shell or any file editing tools inside. Of course, you cannot replace the base image - the container must not be restarted.

You can find the file in the /var/www/html directory. Good luck!

Hint 1

Executing commands in the container is rather challenging in this case. Can you think of another way to modify the file?

Hint 2

Leverage the fact that the container is running on the same machine as you. There must be a way to access its file system.

Hint 3

You can use docker cp to copy files from and to the container.