A registry mirror is a local copy of a Docker registry that stores images closer to users to speed up downloads and reduce load on the main registry.
Click to reveal answer
beginner
Why use a registry mirror?
Using a registry mirror helps reduce download time for images, saves internet bandwidth, and improves reliability when the main registry is slow or unreachable.
Click to reveal answer
intermediate
How does Docker decide to use a registry mirror?
Docker clients check their configuration for mirror URLs and try to pull images from the mirror first before going to the main Docker Hub registry.
Click to reveal answer
intermediate
What is the main configuration file to set up a registry mirror in Docker?
The main configuration file is the daemon.json file, where you add the "registry-mirrors" key with the mirror URL(s).
Click to reveal answer
beginner
Give an example of a registry mirror configuration in daemon.json.
A. Docker will try mirror1 first, then mirror2 if mirror1 fails
B. Docker will download from both mirrors simultaneously
C. Docker ignores mirrors and pulls from the default registry only
D. Docker will fail to pull because multiple mirrors are not allowed
Solution
Step 1: Understand mirror priority
Docker tries mirrors in the order listed, using the first mirror available.
Step 2: Confirm behavior with multiple mirrors
If the first mirror fails, Docker tries the next mirror in the list before falling back to the default registry.
Final Answer:
Docker will try mirror1 first, then mirror2 if mirror1 fails -> Option A
Quick Check:
Mirrors tried in order, fallback if needed [OK]
Hint: Docker tries mirrors in list order, stops at first success [OK]
Common Mistakes:
Thinking Docker downloads from all mirrors at once
Assuming mirrors are ignored
Believing multiple mirrors cause errors
4. You added a registry mirror URL to daemon.json but Docker still pulls images from the default registry. What is the most likely cause?
medium
A. The mirror URL is listed as a string, not inside an array
B. The mirror URL is missing the https:// prefix
C. Docker daemon was not restarted after editing the file
D. Docker does not support registry mirrors
Solution
Step 1: Check Docker daemon reload requirement
Changes to daemon.json require restarting the Docker daemon to take effect.
Step 2: Identify common mistake
Not restarting Docker after editing daemon.json causes the old config to remain active.
Final Answer:
Docker daemon was not restarted after editing the file -> Option C
Quick Check:
Restart Docker after config changes [OK]
Hint: Always restart Docker after changing daemon.json [OK]
Common Mistakes:
Forgetting to restart Docker daemon
Ignoring correct JSON array format
Assuming Docker lacks mirror support
5. You want to configure Docker to use a registry mirror at https://mirror.example.com and ensure it is used for all image pulls. Which steps should you follow?
hard
A. Set an environment variable DOCKER_MIRROR=https://mirror.example.com and restart Docker
B. Add the mirror URL to daemon.json under "registry-mirrors", then restart Docker daemon
C. Add the mirror URL to ~/.docker/config.json and run docker pull --mirror
D. Run docker mirror add https://mirror.example.com command
Solution
Step 1: Configure mirror in daemon.json
Add the mirror URL inside the "registry-mirrors" array in Docker's daemon.json file.
Step 2: Restart Docker daemon
Restart Docker to apply the new mirror configuration so it is used for all image pulls.
Final Answer:
Add the mirror URL to daemon.json under "registry-mirrors", then restart Docker daemon -> Option B
Quick Check:
daemon.json + restart = mirror active [OK]
Hint: Edit daemon.json and restart Docker to activate mirror [OK]
Common Mistakes:
Trying to configure mirror in wrong file
Using non-existent Docker commands
Setting environment variables instead of config
Recommended
Ready to prove it?
Pass the test and this pattern moves unknownstrongwhile earning +1 Grip toward your certificate.