Signals can be used not only to terminate or forcefully kill applications, but also to influence their behavior. For example:
- Nginx will reload its configuration and reopen log files upon receiving
SIGUSR1
. - HAProxy and Gunicorn will reload their configuration upon receiving
SIGHUP
. - Custom apps may implement
SIGUSR1
/SIGUSR2
handlers for debug dumps.
In this challenge, a tiny app is running in a background container named app-1
.
When it receives SIGUSR1
, it prints a line with the current memory usage to its logs.
Your task is to deliver that signal to the container and then capture the exact memory value it reported.
Good luck!
Hint 1: Ways to signal a containerized process 💡
When you run a container on Linux using Docker Engine (or a similar runtime),
the container's process will be a regular process on the host.
If you identify its PID, you can use the host's kill
command to send a signal to it directly.
However, the above approach is not the best way to signal a containerized application.
In some cases, the docker run
command you use to launch a container may be accessing a remote Docker host,
so the container's process won't appear in your local process tree.
For example:
- Docker Desktop on Windows or macOS and even Linux will create a container inside a hidden VM.
- Docker CLI used with the
-H ssh://<some-host>
flag (or a preconfigured context) will run containers on a remote server.
Thus, you need a Docker-native way to signal a containerized application,
which would work regardless of whether you're targeting a local or remote process.
Can you spot a relevant command in docker container --help
?
Hint 2: Why using "docker exec ... kill" will not always work 💡
Using docker exec
to run the kill
command inside the container may sound like a great option.
However, it won't always work.
For example, distroless and FROM scratch
containers usually don't have kill
(and other system utilities) available,
so docker exec ... kill
will fail with a command not found
error.
Even though in this challenge the container is not distroless,
and technically the docker exec app-1 kill
command would work,
the verification script is designed to not accept such a solution.
Hint 3: Accessing container logs 💡
The target application dumps its memory usage to the logs. If you need a refresher on how to access container logs, check out this challenge.
Level up your Server Side game — Join 15,000 engineers who receive insightful learning materials straight to their inbox