Suppose your cardiology service has a small web tool, perhaps a patient-education page or a clinic roster viewer, and it needs to run as a container on one server. This procedure takes it from source code to a running, restartable, well-behaved service in eight steps, plus one bonus. It is a ContainerOps walkthrough: single-host, no orchestrator, and entirely non-clinical. Follow the steps in order; each one leaves something you can check before moving on.
Before you start: what you need and what you are avoiding
You need a host with a container runtime installed, a registry account you control, and the source of the tool. The aim is to avoid the three failures the Ops Atlas keeps returning to: images nobody can trace, deployments that depend on a movable name, and containers that run with more freedom than they need. The Atlas defines the single-container discipline in its ContainerOps entry, and the steps below follow its scope: building, naming, storing and running.
Step 1: Write a two-stage build recipe
Create a build file with a first stage that has all the compilers and package managers, and a second stage that starts from a minimal base and copies in only the finished program. The point is subtraction. A final stage with no shell and no package manager gives an intruder little to work with and gives your patching routine little to track. The Atlas mentions a static minimal base that weighs about two mebibytes as an example of how far this can go.
Check: build the image and list its size. If the final image is larger than the program plus a thin runtime, find out what else came along.
Step 2: Keep secrets out of the build
Never copy a credential file into the image and delete it later. Layers are a stack of recorded changes, so the file survives in the earlier layer even when a later one hides it. Use the builder’s secret-mount feature, which makes the value available for one build step only and leaves no trace in the result.
Check: export the image history and confirm no step mentions a key, token or password.
Step 3: Choose a base that you can trace
Reference the base image by its digest rather than a tag, and write the tag beside it as a comment so a human can see the intent. Then set up an update bot, whether Renovate or Dependabot, to open a proposal when the base is rebuilt. Without the bot, a pin does freeze you in time; with it, the pin becomes a record of exactly which base you tested.
Check: every FROM line in the recipe contains a digest.
Step 4: Run the linter and fix the warnings
A Dockerfile linter such as Hadolint reads the recipe without building it and flags common slips: unpinned bases, shell-form entrypoints, missing user instructions. In the first week run it in warning-only mode so the team learns the rules without breaking builds. Once the backlog is clear, make it block merges.
Step 5: Push, then record the digest
Push the image under a release tag that, by team agreement, will never be reused. The registry then reports a content digest. Write that digest in the change record for the release. From now on, the digest is the identity of the thing you are deploying, and the tag is a convenience label.
Check: pull the image by digest on a second machine and confirm it starts.
Step 6: Configure the runtime safely
- Choose an unprivileged numeric user, for instance 65532, and set it in the recipe.
- Drop all Linux capabilities and add back only those you can name a need for.
- Mount the root filesystem read-only, and give the program one writable temporary directory.
- Set a memory ceiling plus a cap on its process count. Treat a CPU cap as optional until you have measured, since the Atlas warns that it can throttle bursts.
- Publish the port on the loopback address and let a reverse proxy face the network.
That fifth point deserves a sentence of explanation. A port published with only a number listens on every interface, and published ports skip past the host’s firewall front end, so the safest posture is to bind to 127.0.0.1 unless there is a reason not to.
Step 7: Make stopping and logging predictable
Write the entrypoint in exec form so the program itself receives the termination request, add a small init process to reap children, and test that a stop command ends the service within the grace period. Otherwise the engine will force-kill it after ten seconds in a default Compose setup and you will see exit code 137. Then cap the log file size, since the stock json-file driver never rotates. Neither change takes long, and both prevent a late-night call.
Check: stop the container and time it. Fill the log artificially and confirm the cap holds.
Step 8: Deploy by digest and write down the owner
Reference the digest in your Compose file, start the service, and verify that it responds. Record who owns the container, when the base was last updated and where the rebuild instructions live. A container without a named owner ages in silence, a pattern the Atlas files under its warning signs.
Bonus step: Keep a local copy and trim the registry
Once the service is live, look at where its pulls come from. If a public registry is the only source, a throttle or a policy change there could stop your next restart. Place a caching mirror in front of it so that images you have already fetched remain close at hand. Remember that such a cache is a convenience and not a backup: if the upstream copy disappears, the cache will not necessarily keep it for you, so keep your own release images in a registry you control.
Then agree on retention. Every build adds data, and the totals grow faster than people expect, because multiple platforms and frequent builds multiply each other. Decide how many release images to keep, delete untagged leftovers on a schedule, and run garbage collection afterwards so the space is truly returned.
Worked example: a small roster viewer
Imagine the clinic roster viewer is a tiny program that reads a schedule file and renders a page. Its first build produces an image of a few mebibytes after the two-stage change. The team pushes release 1.0, notes the digest in the ticket, and deploys it with a memory ceiling, a read-only filesystem and a loopback-only port behind a proxy. Three weeks later the bot proposes a refreshed base. The team rebuilds, compares the new digest with the old, runs the viewer in a test copy, and promotes the new digest the same afternoon. Nothing about that cycle needed an orchestrator; it needed order and a record.
What to measure afterwards
Track what share of production uses digests, the age of the base images in use, and how long a published upstream fix takes to reach the running container. The Atlas suggests a week for critical fixes as an example target. A simple spreadsheet with one row per container is enough to begin.
Where this sits among your other reading
A team that is new to this might benefit from the background in a reflection on engineering habits and ecosystem thinking in India’s digital sector, which frames why careful delivery habits matter. Staff who also maintain educational content for patients may find the plain structure of the overview of the NYHA functional classification a useful model for how to document a service clearly, though the clinical material there is outside the scope of this guide and belongs to clinicians.
Troubleshooting quick reference
- The container exits with 137 almost immediately: check memory limits first, then the stop handling.
- The service is reachable from the internet unexpectedly: inspect how ports are published.
- A rebuild changes behaviour: compare digests of the base before and after, and read the bot’s proposal.
- The disk fills: look at log files and at old image layers left on the host.
Repeat the eight steps for each additional tool and you will end up with a modest, consistent estate that a colleague can understand in an afternoon. That consistency, more than any single clever setting, is what makes a single-host container deployment dependable.

