Easy, Β onΒ  Containers Submissions: 171/274

There is a web server container running. You need to edit its index.html file without restarting the container:

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

The file is located in the /var/www/html directory.

Hint 1 πŸ’‘

Do you really need a hint? It's an easy one πŸ˜‰ There is a whole bunch of ways to edit a file in a running container. Can you think of a few?

Hint 2 πŸ’‘

Since the editing requirements are relatively simple in this particular case, you can use docker exec sed and the like to edit the file right in the container.

The `docker exec` command illustrated.
Hint 3 πŸ’‘

Not the most secure way, but you can start an interactive shell in the container using docker exec -it sh and install the editor of your choice (e.g. vim or nano) to the running container.

Hint 4 πŸ’‘

The most boring way it to copy the file to your host machine, edit it there using your favorite IDE, and then copy it back. You can use docker cp to copy files from and to the container.

Categories:Β Containers
Discussion:Β  Discord

Level up your server-side game β€” Join 6,500 engineers who receive insightful learning materials straight to their inbox