Graceful Shutdown with SIGTERM Handling
Robinhood ☯️ Medium Docker
Beginner Mode

Start your terminal to use beginner mode.

Scenario:

You have a container image myapp:grace built from /home/interview/Dockerfile that runs an application requiring cleanup on shutdown. When you run docker stop, the container is killed after the 10-second timeout instead of shutting down gracefully because the application doesn't properly handle the SIGTERM signal.

Task:

Fix the application script and Dockerfile to properly handle SIGTERM signals, implement cleanup logic, and ensure the container exits gracefully within 20 seconds when docker stop is executed.

Terminal requires a larger screen

Open this page on a desktop or tablet (≥ 768px) to launch the terminal and practice hands-on.

Linux Terminal Environment

Write and execute your solution in the terminal below.

Sign In

Track

Question Difficulty Company Access
Need more practice in this area? Explore more questions →