Configuring the Docker Daemon (daemon.json) for Production
Tune daemon.json for logging, mirrors, live-restore, and production defaults.
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
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.
{ "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, 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.
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.
How it works, step by step
Step 1 of 41. 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.
- 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 behaviorin 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
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.
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.
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 skippingjq -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?
{ "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
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.