Interview's MateDocker
Interview's Mate

Docker

Compose · Networking · Security · Ops

Visualizer

DSA Visualizer
All 32 lessons
Custom Playground
Try your own examples

Learning

System Design
31 architecture topics
SQL Learning
160 foundations → production topics
AI Engineering
160 LLM → backend topics
Data Science
160 Python → MLOps topics
Data Engineer
160 SQL → streaming topics
Docker
160 Docker learning topics
Kubernetes
160 K8s fundamentals → cloud
Java LearnSoon
Coming soon
Python Learn
Interview Q&A & internals
JavaScript Learn
Closures, async & DOM Q&A
Tech Learn
Search, practise & track Q&A
AI DSA Practice
Solve coding problems
Theme
Home
Docker topics
Lesson 137/ 160
07. CI/CD, Registries & Production Operations

Configuring the Docker Daemon (daemon.json) for Production

Tune daemon.json for logging, mirrors, live-restore, and production defaults.

Advanceddaemon.json · live-restore3 quiz questions
Practice DevOps Q&A
In plain wordsDiagramTheoryStep by stepWhen to use itInterview cluesMistakes to avoidQuiz (3)Practice

In plain words

Manage daemon configuration as reviewed host config, validate it before restart and preserve a rollback connection to the host.

Think of it like…

daemon.json is the machine-room control panel: one setting applies to every future tenant, so a bad switch affects the entire building.

Where you’ve seen it

In practice, { "log-driver": "local", "log-opts": { "max-size": "10m", "max-file": "3" }, "live-restore": true, "registry-mirrors": ["https://mirror.example.com"] } is the concrete move for this job: tune daemon.json for logging, mirrors, live-restore, and production defaults. The release is not accepted until jq -e . /etc/docker/daemon.json && systemctl restart docker && docker info; keep an out-of-band host shell and inspect existing/restarted driver behavior confirms the result.

Words you’ll hear

daemon.json
The implementation control in { "log-driver": "local", "log-opts": { "max-size": "10m", "max-file": "3" }, "live-restore": true, "registry-mirrors": ["https://mirror.example.com"] } for tune daemon.json for logging, mirrors, live-restore, and production defaults.
live-restore
The result to observe with jq -e . /etc/docker/daemon.json && systemctl restart docker && docker info; keep an out-of-band host shell and inspect existing/restarted driver behavior, rather than infer from a successful command alone.
Mirrors
The production boundary exposed when editing JSON through a remote-only Docker terminal and losing the daemon before rollback, or marking a public registry insecure as a network workaround.

Visual diagram

Loading interactive diagram

Theory & deep dive

daemon.json control path

The concrete mechanism is { "log-driver": "local", "log-opts": { "max-size": "10m", "max-file": "3" }, "live-restore": true, "registry-mirrors": ["https://mirror.example.com"] }. The observable result is jq -e . /etc/docker/daemon.json && systemctl restart docker && docker info; keep an out-of-band host shell and inspect existing/restarted driver behavior; if those disagree, inspect the runtime evidence before changing unrelated settings.

Tune daemon.json for logging, mirrors, live-restore, and production defaults. Keep daemon.json, live-restore and Mirrors in the same deployment record so the intent and the observed state cannot drift apart.

Concrete daemon.json setup

{ "log-driver": "local", "log-opts": { "max-size": "10m", "max-file": "3" }, "live-restore": true, "registry-mirrors": ["https://mirror.example.com"] }

Key takeaway: Prove live-restore with jq -e . /etc/docker/daemon.json && systemctl restart docker && docker info; keep an out-of-band host shell and inspect existing/restarted driver behavior, not with command success alone.

Mirrors failure boundary

Changing log-driver on the daemon does not rewrite running/existing container drivers. live-restore preserves containers over daemon downtime but does not make images, networks or the daemon itself HA, and an insecure registry exception expands supply-chain trust. The narrow failure to design for is editing JSON through a remote-only Docker terminal and losing the daemon before rollback, or marking a public registry insecure as a network workaround.

Accept this compromise explicitly: Host defaults simplify fleets; service-level overrides are still required for workloads with different retention or transport needs. The controlled check-jq -e . /etc/docker/daemon.json && systemctl restart docker && docker info; keep an out-of-band host shell and inspect existing/restarted driver behavior-also identifies the point where a different design is safer.

Deliberate failure test

Exercise this failure safely: editing JSON through a remote-only Docker terminal and losing the daemon before rollback, or marking a public registry insecure as a network workaround.

Key takeaway: Host defaults simplify fleets; service-level overrides are still required for workloads with different retention or transport needs.

How it works, step by step

Step 1 of 4
Design

1. State the boundary

Write down why the workload needs this: Changing log-driver on the daemon does not rewrite running/existing container drivers. live-restore preserves containers over daemon downtime but does not make images, networks or the daemon itself HA, and an insecure registry exception expands supply-chain trust.

Manage daemon configuration as reviewed host config, validate it before restart and preserve a rollback connection to the host.
Key numbers at this step
Intent
daemon.json

When to use it & trade-offs

What it is

The daemon /etc/docker/daemon.json sets host-wide defaults for logging, registry mirrors, insecure registries, live-restore, storage data root and authorization. It is one JSON object loaded on daemon restart; a syntax error can make Docker unavailable.

Why it matters: Changing log-driver on the daemon does not rewrite running/existing container drivers. live-restore preserves containers over daemon downtime but does not make images, networks or the daemon itself HA, and an insecure registry exception expands supply-chain trust.

When to reach for it

  • The fit is strongest for this job: tune daemon.json for logging, mirrors, live-restore, and production defaults. Pair it with jq -e . /etc/docker/daemon.json && systemctl restart docker && docker info; keep an out-of-band host shell and inspect existing/restarted driver behavior in the runbook.
  • Production daemon.json changes should make live-restore observable through { "log-driver": "local", "log-opts": { "max-size": "10m", "max-file": "3" }, "live-restore": true, "registry-mirrors": ["https://mirror.example.com"] }, rather than trusting the runtime default.
  • Keep a rollback example for the case where editing JSON through a remote-only Docker terminal and losing the daemon before rollback, or marking a public registry insecure as a network workaround.

When to avoid or be careful

  • Do not accept command success while the system can still fail by editing JSON through a remote-only Docker terminal and losing the daemon before rollback, or marking a public registry insecure as a network workaround.
  • Avoid erasing Mirrors protection merely to dodge this cost: “Host defaults simplify fleets; service-level overrides are still required for workloads with different retention or transport needs”.
  • Do not replace the evidence path-jq -e . /etc/docker/daemon.json && systemctl restart docker && docker info; keep an out-of-band host shell and inspect existing/restarted driver behavior-with a screenshot or a mutable tag.

{ "log-driver": "local", "log-opts": { "max-size": "10m", "max-file": "3" }, "live-restore": true, "registry-mirrors": ["https://mirror.example.com"] }: practical choices

Explicit daemon.json
Best for: Tune daemon.json for logging, mirrors, live-restore, and production defaults, with a reviewed runbook.

Strengths: The daemon /etc/docker/daemon.json sets host-wide defaults for logging, registry mirrors, insecure registries, live-restore, storage data root and authorization. It is one JSON object loaded on daemon restart; a syntax error can make Docker unavailable.

Watch out: Host defaults simplify fleets; service-level overrides are still required for workloads with different retention or transport needs.

Ambient default
Best for: Short-lived live-restore experiments with low blast radius.

Strengths: It can begin with { "log-driver": "local", "log-opts": { "max-size": "10m", "max-file": "3" }, "live-restore": true, "registry-mirrors": ["https://mirror.example.com"] } and fewer surrounding controls.

Watch out: It silently accepts editing JSON through a remote-only Docker terminal and losing the daemon before rollback, or marking a public registry insecure as a network workaround, which makes the result hard to reproduce after promotion.

Managed Mirrors
Best for: Teams that centralize Mirrors policy across many workloads.

Strengths: Changing log-driver on the daemon does not rewrite running/existing container drivers. live-restore preserves containers over daemon downtime but does not make images, networks or the daemon itself HA, and an insecure registry exception expands supply-chain trust.

Watch out: The platform adds an ownership and debugging layer; retain jq -e . /etc/docker/daemon.json && systemctl restart docker && docker info; keep an out-of-band host shell and inspect existing/restarted driver behavior as the direct check.

Interview signals & numbers to know

When this topic comes up

  • { "log-driver": "local", "log-opts": { "max-size": "10m", "max-file": "3" }, "live-restore": true, "registry-mirrors": ["https://mirror.example.com"] }
  • jq -e . /etc/docker/daemon.json && systemctl restart docker && docker info; keep an out-of-band host shell and inspect existing/restarted driver behavior
  • Failure signature: editing JSON through a remote-only Docker terminal and losing the daemon before rollback, or marking a public registry insecure as a network workaround
  • Trade-off: Host defaults simplify fleets; service-level overrides are still required for workloads with different retention or transport needs.

Benchmarks & rules of thumb

10 MB × 3 -
daemon default local log files
1 host-wide file -
applies to daemon-managed defaults
0 HA guarantee -
from live-restore alone

Common mistakes & follow-ups

Common interview mistakes

  • Treating a successful { "log-driver": "local", "log-opts": { "max-size": "10m", "max-file": "3" }, "live-restore": true, "registry-mirrors": ["https://mirror.example.com"] } as proof and skipping jq -e . /etc/docker/daemon.json && systemctl restart docker && docker info; keep an out-of-band host shell and inspect existing/restarted driver behavior.
  • Editing JSON through a remote-only Docker terminal and losing the daemon before rollback, or marking a public registry insecure as a network workaround
  • Optimizing daemon.json without accepting that host defaults simplify fleets; service-level overrides are still required for workloads with different retention or transport needs.

Likely interviewer follow-ups

  • Why does { "log-driver": "local", "log-opts": { "max-size": "10m", "max-file": "3" }, "live-restore": true, "registry-mirrors": ["https://mirror.example.com"] } address daemon.json here rather than through application code?
  • How would you distinguish healthy live-restore from the failure “editing JSON through a remote-only Docker terminal and losing the daemon before rollback, or marking a public registry insecure as a network workaround” using jq -e . /etc/docker/daemon.json && systemctl restart docker && docker info; keep an out-of-band host shell and inspect existing/restarted driver behavior?
  • When would this trade-off-“Host defaults simplify fleets; service-level overrides are still required for workloads with different retention or transport needs”-justify a different Mirrors design?
Interview tip: Give one concrete operation-{ "log-driver": "local", "log-opts": { "max-size": "10m", "max-file": "3" }, "live-restore": true, "registry-mirrors": ["https://mirror.example.com"] }-and one proof-jq -e . /etc/docker/daemon.json && systemctl restart docker && docker info; keep an out-of-band host shell and inspect existing/restarted driver behavior. Then name the boundary: editing JSON through a remote-only Docker terminal and losing the daemon before rollback, or marking a public registry insecure as a network workaround.

Knowledge check

Loading quiz

Put it into practice

Practice related interview Q&A

Apply Configuring the Docker Daemon (daemon.json) for Production with generative AI interview Q&A and hands-on practice.

Open DevOps Q&A →Tech Learn Q&A
Previous topic
Automated Container Updates (Watchtower & Renovate/Dependabot)
Next topic
GPU Acceleration in Docker (NVIDIA Container Toolkit & --gpus all)