Bird
0
0

You want to automate daily backups of a Docker volume dbdata to a host directory /backups. Which approach is best?

hard📝 Workflow Q8 of 15
Docker - Production Patterns
You want to automate daily backups of a Docker volume dbdata to a host directory /backups. Which approach is best?
AManually run docker run commands each day
BCreate a cron job on the host that runs a container to tar the volume into /backups
CUse docker commit to save the volume state daily
DRestart Docker daemon daily to trigger automatic backups
Step-by-Step Solution
Solution:
  1. Step 1: Identify automation method

    Automating backups requires scheduling a repeatable command, like a cron job on the host.
  2. Step 2: Choose correct backup technique

    Running a container that mounts the volume and host backup directory to create tar archives is effective and scriptable.
  3. Final Answer:

    Create a cron job on the host that runs a container to tar the volume into /backups -> Option B
  4. Quick Check:

    Automate backups with cron + container tar [OK]
Quick Trick: Use host cron + container tar for automated backups [OK]
Common Mistakes:
  • Using docker commit which saves images, not volumes
  • Relying on manual commands for automation
  • Restarting Docker daemon does not backup data

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Docker Quizzes