My phone rang at 02:47 in the morning. The monitoring system was telling me disk usage on the production server had hit 98 percent. I connected with sleepy eyes, looked at the df output, and couldn't make sense of it: the application data was around 60 GB, and the disk was 500 GB. When I drilled down through the layers with du, the truth came out: under /var/lib/docker/containers, a single container's log file had grown to 312 GB. We had moved to Docker three weeks earlier, and nobody had read that the json-file log driver writes without limits by default.
That night, we learned the first of seven lessons from our adventure moving our vehicle tracking platform into containers. The other six followed close behind. Let me walk through them in order; maybe you won't have to pay the price we did.
First, let me set the scene: why were we switching? Over three years, hundreds of small manual tweaks had quietly made our three production servers drift apart from one another. One had one version of libssl, another had a different one; a library update would go smoothly on server A and be a disaster on server B. Putting a new service into production took half a day of "which dependency is on which machine" archaeology. Docker promised us one thing, and it kept that promise: whatever is in the image is what runs in production. But around that promise was a minefield nobody mentions in the brochure. We stepped on seven mines, and we've marked where every one of them is.
The Log Driver Doesn't Ask, It Just Fills Your Disk
Lesson one: Docker's default logging configuration is a trap for production. Our TCP listener was logging every device packet at debug level; 9 GB of text a day. The fix was two lines: using the max-size and max-file settings, a limit of 5 files of 10 megabytes each per container. Later we started shipping logs to a central location, but that first night, the two lines in daemon.json were enough. That same night we also learned that this setting is host-level and isn't applied retroactively to existing containers; we had to recreate all of them.
You Can't Deploy With a 1.9-Gigabyte Image
Our first Dockerfile was a 1.9 GB monster built on ubuntu:20.04 and carrying everything, build tools included. Pulling that image to three servers on every deploy took 6-7 minutes; when you need an urgent patch, that feels like hours. We moved to a multi-stage build: a separate build stage, and an alpine-based runtime stage. The image dropped to 214 MB, and once the layer cache was used properly, deploys fell to 50 seconds. Side benefit: a small image also has a small attack surface; the number of warnings in the security scan dropped from 140 to 12.

There's No Such Version as latest
We learned the third lesson on a Friday afternoon. Everything was green in staging; we went to production with the same compose file, and the reporting service wouldn't start. The reason: the image tag was latest, and the two environments had pulled the image at different times. In the four hours in between, a new minor version of the base image had been released and a library's behavior had changed. From that day on, the rule was clear: every image that goes to production is tagged with its commit hash. In our vocabulary, the word latest means "I don't know which version this is."
When the Container Dies, the Data Dies With It
The fourth lesson was the most painful. A small helper service kept its queue of unprocessed SMS messages in a SQLite file inside the container. When the container was deleted and recreated during an update, 4 hours of unsent notifications vanished. We went through a silence that was hard to explain to customers. We defined a named volume for every path that needs to persist and, more importantly, we built an inventory: every service has to have a written answer to the question "what is lost if the container is deleted?" A service whose answer isn't "nothing" can't go to production.
The volume lesson has a second act too: backups. Moving the data to named volumes had put us at ease; until, during a drill, we noticed those volumes had never been included in the nightly backup. The old backup script copied specific directories, and /var/lib/docker/volumes didn't exist in its world. We tied the volume inventory to the backup script and, more importantly, put a monthly rehearsal on the calendar: pick a volume at random and restore it from backup. A backup that's been taken but never restored is nothing more than hope.

Being PID 1 Is Harder Than You Think
The fifth lesson was sneaky. During deploys, the last few seconds of data from some GPS connections would go missing. The loss was so small that for months we wrote it off as "device-related." The real cause: because our application was started in shell form in the Dockerfile, PID 1 was the shell, and SIGTERM never reached the application. Docker would wait 10 seconds and then send SIGKILL, and the process died before the buffered data could be flushed to disk. Once we switched to exec form and wrote a proper shutdown routine that catches the signal, the loss went to zero. In the container world, graceful shutdown isn't a luxury; it is data integrity itself.
There's a footnote to this lesson: the shutdown timeout can be tuned too, and it should be. The default 10-second wait was too tight for a service that drains buffers and closes TCP connections cleanly; we raised it to 30 seconds with stop_grace_period. Conversely, for stateless API containers even 10 seconds was unnecessary; they wind down in 2 seconds. Thinking through shutdown behavior service by service completely ended those small but annoying error spikes during deploys.

Whose Clock Is the Container's Clock?
The sixth lesson looks funny, but it wasn't: on the first morning after the migration, a customer told us they had received their shift report email at 03:00 at night. The containers were running on UTC, the host was on Istanbul time, and the scheduled jobs had shifted by three hours. Our permanent fix wasn't distributing time zones to the containers; it was having the application speak UTC everywhere and convert only when displaying to the user. That discipline later headed off a whole different set of headaches too.
Without Limits, It Eats the Neighbors
Lesson seven: a container with no resource limits is the common enemy of everyone on the same host. Our reporting service ballooned its memory while generating a large PDF, the kernel's OOM killer kicked in, and it picked the database container on the same machine as its victim. Since that day, every container's memory and CPU limits are written in the compose file; a service without limits can't pass code review. Limits feel like needless bureaucracy at first; after the first OOM murder, they become an insurance policy.
A Free Eighth Lesson: Resisting Orchestration
There's also an eighth lesson we learned without paying for it. As soon as we moved to Docker, the "when are you moving to Kubernetes?" questions started coming in from all sides. We evaluated it seriously and decided that a Kubernetes set up for three servers and fifteen containers would bring us more new problems to learn and operate than problems it would solve. docker-compose plus a solid deploy script does the job at our scale; restart policies and healthchecks cover 90 percent of our self-healing needs. The need for an orchestrator comes with scale; an orchestrator set up before the scale arrives turns into a hobby project that swallows all the working hours of a two-person infrastructure team. We revisit this decision every quarter; so far it has landed in the same place every time.
Looking at the picture a year later, the balance sheet of the migration is clear: our deploy time went from minutes to seconds, the phrase "it works on my machine" disappeared from our meetings, and setting up a new developer's machine dropped from two days to an hour. In total, the seven lessons cost us a few nights of sleep and one apology call to a customer; next to the peace of mind they brought, that even counts as cheap.
The common denominator of all seven lessons is this: Docker itself never let us down; trusting the defaults did. Container tooling is maturing fast, but the default settings are still chosen for developer experience, not for production resilience. When you plan your migration, you can use these seven headings as a checklist. If you're stuck at some point in your own migration story, reach out through the contact page; chances are we've fallen into the same hole ourselves.