Saturday mornings in Chennai have a rhythm: filter coffee, a slow start, and the quiet hours before the city fills up. That is a good time to fix the one thing at work that has been annoying you all month. For plenty of small teams, that thing is a container that mostly behaves and occasionally does not. It restarts at odd moments, eats a disk, answers on a port it should not, or takes ages to stop. This walkthrough takes one such container through seven steps, using the Ops Atlas description of ContainerOps as the checklist.
Imagine a small ticketing site run by two people. One evening the site slowed to a crawl, the disk filled up, and the container had to be restarted by hand. Nobody had been careless; it simply had never been looked after as a thing in its own right. That is what ContainerOps is about, according to the Ops Atlas page on ContainerOps: the daily care of a single container, below the level where a big orchestrator would take over. The Atlas also concedes that nobody has made the name official, which hardly matters, since the steps stand on their own.
Step 1: Write down what is actually running
Before changing anything, record the facts. For your container, note the image name, the tag it was started from, the user it runs as, its published ports, its memory setting if any, and where its logs are going. Ten minutes with a notebook is enough. The Atlas starts its own thirty-day plan with an inventory for the same reason: you cannot improve what you have not listed. Keep the page; you will want to compare it with the “after” page at the end.
Step 2: Fix the stopping behaviour
Stop the container and time it. If it takes ten seconds every time, that is the default waiting period before a forced kill, and it usually means the polite stop request never reached your program. The Atlas explains the cause: an entrypoint written in shell form is launched through a wrapper shell, and that wrapper never passes the request along. The cure has three parts. Write the entrypoint in the exec form, make the program handle the request properly, and add a tiny init process with the init flag. Run the stop again; a good result is a clean exit within a second or two, not the 137 code that signals a forced kill.
Step 3: Give it a ceiling
Next, put a cap on memory and another on how many processes the container may spawn. Choose numbers from what you observed on a normal day plus generous headroom, not from guesswork. The entry says these two should always be set. It is more hesitant about processor limits, because short bursts can be held back even when the average looks low, so leave that for later unless a neighbour is starving. One extra tip: after setting the memory limit, watch for restarts over a few days. A restart with code 137 means the ceiling was hit and either the limit is too low or the program has a leak worth finding.
Step 4: Take away privileges
Change the container to run as an ordinary numbered user, not the administrator. The Atlas uses 65532 as an example of such an identity. Mount the root filesystem read-only, and drop all special capabilities, adding back only what the program demonstrably needs. This is the step most likely to produce a small error at first, typically a directory the program cannot write to. Give that single directory its own writable mount and the problem goes away. Resist the temptation to switch privileges back on in frustration; each error you resolve is one fewer thing an intruder could have used.
Step 5: Close the side door
Look at the published ports in your notes. Where a mapping names no host address, the port is open on every network interface, and the Atlas observes that such ports may slip past the usual host firewall rules, since the engine routes them ahead of those rules. Suppose a port exists solely for a reverse proxy sitting on the same machine; tie it to the loopback address. Containers that merely chat among themselves can share an internal network with no route outward. Then test from another machine on your network to confirm what is reachable. It is a small step with outsized effect.
Step 6: Stop the disk from filling
The story at the top ended with a full disk, and the usual culprit is the default log driver, which stores every line forever unless told otherwise. Set a maximum file size and a maximum count of files for the container’s logs. Where the logs go afterwards, for example into a central search tool, belongs to another discipline in the Atlas’s scheme. For this weekend job it is enough that they cannot fill the machine.
Step 7: Name your image by its fingerprint
Finally, change the deployment to refer to the image digest, a long hash of its exact content, instead of a moving tag. If you need to roll back, you can name exactly what you ran before. Keep a human-friendly release tag as a label, and decide that it is never reassigned. Last, ask a helper bot to propose new digests when the base image is rebuilt, so the fingerprint does not become a fossil. The Atlas stresses that pinning without an update routine is the real cause of stale software, not pinning itself.
One sentence of reassurance before the last comparison. None of these steps needs special software, a budget, or a change of platform. They are edits to a few lines of configuration plus a bit of watching, and each can be reversed in minutes if it misbehaves. That reversibility is what lets a two-person team try them on a quiet Saturday without fear.
Compare the before and after pages
Pull out the page from Step 1 and fill in a second column. Stopping now takes a moment, the memory and process ceilings are set, the process runs as a plain user with a read-only filesystem, ports are bound deliberately, logs are capped, and the image is named by digest. For a few hours’ work on a weekend, that is a meaningful shift from “mostly behaves” to “behaves predictably”. Repeat the same seven steps for the next container on your list.
Take a proper break afterwards
Good operations work is steady rather than heroic, and the rest matters. If the city is calling, plan something that has nothing to do with screens: our notes on enjoyable places in Chennai worth a visit and the culture and heritage on offer in a Chennai travel guide are a decent place to start. You will come back on Monday with a quieter pager and a notebook page you can show your team.
What not to do this weekend
Do not attempt to migrate everything at once, and do not touch a container that is currently handling heavy traffic without a way back. Skip scanning, signing and orchestration projects for now; the Atlas treats them as separate subjects. Pick one container, apply seven steps, write down what changed, and stop. Small, finished improvements are the ones that survive contact with a busy week.