Challenge, Easy,  on  ContainersLinux

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: 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 13,000 engineers who receive insightful learning materials straight to their inbox