Linux Labs

Containers: Docker and compose / Stage 10 of 11

Limits, OOMKilled and the user in a container

Not running Starting usually ~20 s
Leave the lesson

Step 8 of 9 · lab · 25 minmedium

A container restarts under load

The import service moved into a container and has not processed a single export since — the container is up one moment and restarting the next. Find the cause and fix it so that the service handles the load within the limits it was given.

Situation

The ingest service processes the nightly sales exports: a CSV file appears in /srv/ingest/inbox, and a summary of it appears in /srv/ingest/done. Until last week the service ran as the ingest system user, and the /srv/ingest directory belongs to that user. Then it was moved into a Docker container: the container is created by the /opt/ingest/run.sh script, and the import code sits next to it in /opt/ingest.

Since the move, not a single export has been processed: today's one, 40 MiB, is still sitting in inbox, and docker ps shows ingest up for a couple of seconds one moment and restarting the next.

Task

  1. ingest processes exports and does not restart: the check will drop its own 40 MiB export into inbox and wait for the summary. Do not change the import code in /opt/ingest.
  2. The memory limit of the ingest container is 128 MiB: that is how much the service is given on this machine.
  3. The process in the container runs as the ingest user and group, as it did before the move.
  4. ingest comes up by itself after the machine reboots.

Run docker commands with sudo: the student user has no direct access to Docker. The machine has no internet access; the alpine image is already loaded.

Lab · on your own

No commands are given in this lab: type them in the terminal yourself. Goals are checked on the machine after every command.

Goals

0 of 4
  • ingest processes a 40 MiB export without restarting, and the import code is unchanged — not done yet
  • The memory limit of the ingest container is 128 MiB — not done yet
  • The process in the container runs as the ingest user and group — not done yet
  • ingest comes up by itself after the machine reboots — not done yet
Ctrl+Enter
Starts the machine node1 · Ubuntu 24.04

The machine is starting

Hints

0 of 3

Lab goals

0 of 4
  • ingest processes a 40 MiB export without restarting, and the import code is unchanged — not done yet
  • The memory limit of the ingest container is 128 MiB — not done yet
  • The process in the container runs as the ingest user and group — not done yet
  • ingest comes up by itself after the machine reboots — not done yet
node1 Ubuntu 24.04

Lab goals

0 of 4
  • ingest processes a 40 MiB export without restarting, and the import code is unchanged — not done yet
  • The memory limit of the ingest container is 128 MiB — not done yet
  • The process in the container runs as the ingest user and group — not done yet
  • ingest comes up by itself after the machine reboots — not done yet
Loading…