Sign inSign up free

514. Make the App Receive SIGTERM

medium 20 XP ~10 minHands-on lab

Every deploy of chat-relay waits the full 10-second grace period before the old container is killed, and in-flight requests are cut off. The app handles SIGTERM correctly, but it never receives it.

The image is defined in /home/student/projects/chat-relay/Dockerfile, with docker-entrypoint.sh next to it.

Task

  • In the Dockerfile, write ENTRYPOINT and CMD in exec (JSON) form: the entrypoint is /usr/local/bin/docker-entrypoint.sh, and the default command is python3 /app/server.py.
  • Fix docker-entrypoint.sh so that, after its setup steps, it replaces itself with the command it's given ("$@"), keeping every argument intact. Its setup steps must still run.

There's no container engine here. The grader reads the Dockerfile and runs your entrypoint script with test commands.

About this machine

Ubuntu 24.04 with no internet access. You are student with passwordless sudo. The grader checks the final state of the machine, not the commands you typed. Values like names and ports are generated for you.

Part of Docker Fundamentals. Next step: Unable to Locate Package, Months Later

Teaching or writing about this? Embed this lab on your page

TerminalNot started

Your machine is ready to start

A fresh, isolated Ubuntu machine boots in a few seconds with the task already set up.

No account needed: 3 of 3 free tries left. Guest machines last 30 minutes.