inflearn logo

Running Dockerized MySQL and PostgreSQL in Production Without Losing Data — 30 Container Database Incidents Recreated by a Practicing DBA

If you run your database in Docker, you’ll learn how to reproduce 30 scenarios on your own computer that can wipe your data or make it unreadable—from `down -v` and `prune` to folder names, password environment variables, 10-second shutdowns, memory limits, image tags, and volume-copy backups. You’ll read the database logs to find the cause, then learn how to restore your data using point-in-time recovery.

1 learners are taking this course

Level Intermediate

Course period Unlimited

MySQL
MySQL
database
database
Docker
Docker
PostgreSQL
PostgreSQL
MySQL
MySQL
database
database
Docker
Docker
PostgreSQL
PostgreSQL

What you will gain after the course

  • Identifies commands and settings in the current Compose file that can cause data loss (down -v, prune -a, project names, anonymous volumes, --rm).

  • Avoid the pitfalls of things that work “only the first time,” such as passwords, initialization scripts, and health checks.

  • Read the forced shutdown and recovery logs, then configure the shutdown timeout, memory limit, shared memory, and disk for the database.

  • Identify and fix where time zones, character sets (garbled Korean text), and sorting rules silently change in containers.

  • Pin the image tags and rehearse MySQL 8.0→8.4 and PostgreSQL 16→17 upgrades using volume copies.

  • Take consistent backups and measure restoration time, then use binary logs (GTID) and WAL archives to restore to the point just before the mistake.

"Could this one command wipe out my database?"

If you’re running a DB with Docker, you’ll recreate 30 scenarios on your own computer that can wipe your data or make it unreadable—from `down -v` and `prune` to folder names, password environment variables, 10-second shutdowns, memory limits, image tags, and volume-copy backups. You’ll learn to diagnose the cause from DB logs and restore your data using point-in-time recovery.

Most Docker courses end at getting a database up and running. This course goes further, covering what happens when you lose access to data or can no longer read it while operating that database. Every scenario is based on actual command output, and you’ll trace the cause on the database side—not the container side—through logs, recovery processes, file versions, and configuration values. It includes the exact troubleshooting steps used in production by a team lead DBA at a major e-commerce company.

By the end of this course, you’ll be able to

  • Identify the commands and settings in your current Compose file that can cause data loss (down -v, prune -a, project names, anonymous volumes, --rm).

  • Avoid the pitfalls of things that work “only once,” such as passwords, initialization scripts, and health checks.

  • Read forced-shutdown and recovery logs, then set the shutdown timeout, memory limits, shared memory, and disk capacity to suit the database.

  • We check and fix places where time zones, character sets (garbled Korean text), and collation rules silently change in containers.

  • Pin image tags and rehearse MySQL 8.0→8.4 and PostgreSQL 16→17 upgrades using volume copies.

  • Create consistent backups, measure restore times, and use binary logs (GTID) and WAL archives to recover to the point just before a mistake.

Recommended for

  • Backend developers who use Docker to run MySQL and PostgreSQL for services and side projects.

  • Those who have completed an introductory Docker course and are wondering, 'What should I be careful about in production?'

  • A solo operator at a startup who has ended up responsible for the database as well.

  • Junior DBA/SRE

Curriculum (9 sections · 30 lessons · approx. 181 minutes)

  • Section 1. Container Databases: What Stays Where — One command made the orders disappear, setting up the practice environment, where does the data go?

  • Section 2. Commands that delete data — stop·down·down -v·prune, I only changed the folder name but got an empty DB, anonymous volumes and --rm

  • Section 3. What runs only the first time — I changed the password, but it didn’t change; the initialization script only ran halfway; the lie that it’s ready

  • Section 4. How to stop and recover — docker stop only waits 10 seconds, reading recovery after a forced shutdown, setting the shutdown timeout

  • Section 5. Memory and disk limits — Memory limits and OOMKilled, how a DB sees memory, PostgreSQL shared memory at 64MB, the disk filled up

  • Section 6. Subtle Configuration Differences — Time zones: containers use UTC, Korean text was inserted garbled, changing the image changed the sort order

  • Section 7. Image Tags and Upgrades — The day a tag can’t read the data, from MySQL 8.0 to 8.4, PostgreSQL major upgrades, upgrade rehearsals

  • Section 8. Backup and Recovery — Is Copying a Volume a Backup?, Dump Consistency, What’s Not in a Dump: Accounts and Privileges, Timing a Restore, Using Binary Logs to Go Back to Just Before a Mistake, Point-in-Time Recovery with WAL Archiving

  • Section 9. Conclusion — Ports, passwords, and an operations checklist

Practice Environment

You’ll receive hands-on materials (ZIP) with official MySQL 8.4.13, 8.0.44, PostgreSQL 17.7, 16.11, and 17.7-alpine images and virtual shopping mall data, ready to run through all 30 scenarios. Each lesson covers one scenario; run it to recreate the same setup shown in the lesson. A container database operations checklist is also included.

Prerequisites

  • Experience using docker run · docker compose

  • SQL Basics (SELECT · INSERT)

  • A computer with Docker installed (at least 6 GB of memory allocated is recommended)

What This Course Does Not Cover

  • Docker Basics: Syntax from the Beginning

  • Kubernetes·Operators

  • Setting Up a Cloud-Managed Database (RDS, etc.)

  • Query tuning and execution plans

Notice

The slide narration is synthesized speech. All data are simulated for educational purposes, and numbers may vary depending on the execution environment.

Recommended for
these people

Who is this course right for?

  • Backend developer running services and side projects with MySQL and PostgreSQL in Docker.

  • For those who have completed an introductory Docker course and are wondering what to watch out for in production.

  • A solo operator who ended up handling everything from startup operations to the database.

  • Junior DBA/SRE

Need to know before starting?

  • Experience using docker run and docker compose

  • SQL Basics (SELECT·INSERT)

  • A computer with Docker installed (allocating at least 6 GB of memory is recommended)

Hello
This is dorian05202988

Career Verified

A data craftsman with over 20 years of experience in databases and IT. As a DBA and manager of a DB Platform team, I work with database platforms and specialize in MySQL, PostgreSQL, Oracle, MongoDB, SQL tuning, AWS, Terraform, and Python. Drawing on experience in the gaming, finance, and IT services industries, I explain database and cloud architecture. I have published 『Oracle Practical Tuning: Learning SQL Patterns』 and 『Oracle Pro*C Practical Project Guide』, and have presented on serverless architectures, database selection, and multi-database strategies at AWS Summit 2018 and 2019 and DataYa Nolja 2020. Recently, I have been working on slow-query analysis and tuning recommendations using Bedrock LLM, automated DB specification sizing, and query workflows through a DB metadata MCP server and Slack bot. I explain database automation for developers and AI applications for non-developers through hands-on exercises tailored to the audience and objectives of each course. Rather than applying AI suggestions as-is, I teach a decision-making framework that verifies result equivalence, execution plans, and observability conditions, and defers action when the supporting evidence is insufficient. Company operational data and credentials are not included in the course materials.

More

Curriculum

All

30 lectures ∙ (3hr 0min)

Course Materials:

Lecture resources
Published: 
Last updated: 

Reviews

Not enough reviews.
Please write a valuable review that helps everyone!

dorian05202988's other courses

Check out other courses by the instructor!

Similar courses

Explore other courses in the same field!

Limited time deal

$61,600.00

20%

$59.40