Challenge, Medium,  on  Containers

Running containers is just the beginning. In real-world scenarios, you will often need to peek inside the running containers to debug issues, inspect files, or execute additional commands. This is where the docker exec command becomes your best friend for container troubleshooting and exploration.

In this challenge, a Python API server is already running in a container called app-1. The application serves its main endpoints on 0.0.0.0:8080 but also opens a special debugging interface on 127.0.0.1:9000/debug. Since the debugging port is opened on localhost, it can only be accessed from within the container.

Your mission is to:

  1. Start an interactive shell inside the running app-1 container.
  2. Query the debugging endpoint to inspect the application's state.

Good luck!

Hint 1: Starting an interactive shell 💡

The docker exec command allows you to execute arbitrary commands inside a running container. To start an interactive shell session, you typically need to:

Try running docker exec --help to see the exact syntax or check this tutorial for more details.

docker exec command under the hood: executing a new process in the already running container, sharing the same namespaces and cgroups.
Hint 2: Installing packages in the container 💡

While it's not a good practice to install packages in the containers on the fly, sometimes, you'll have to do it to complete your debugging or troubleshooting task.

If the target container does not have an HTTP client installed, you can install curl using the following command:

apt update && apt install -y curl

Level up your Server Side game — Join 11,000 engineers who receive insightful learning materials straight to their inbox