Bird
Raised Fist0
Dockerdevops~20 mins

Registry mirroring concept in Docker - Practice Problems & Coding Challenges

Choose your learning style10 modes available
Challenge - 5 Problems
🎖️
Registry Mirror Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate
1:30remaining
What is the main purpose of a Docker registry mirror?

Choose the best explanation for why a Docker registry mirror is used in a development environment.

ATo automatically update Docker images to the latest version without manual intervention.
BTo cache images locally to speed up image pulls and reduce bandwidth usage.
CTo create a backup of all Docker images in case the main registry fails.
DTo convert Docker images into a different container format for compatibility.
Attempts:
2 left
💡 Hint

Think about how mirrors help when many users pull the same images repeatedly.

💻 Command Output
intermediate
1:30remaining
What is the output of the Docker daemon when configured with a registry mirror?

Given the Docker daemon configuration below, what message will appear in the daemon logs when pulling an image?

Docker
{
  "registry-mirrors": ["https://mirror.example.com"]
}
AUsing registry mirror https://mirror.example.com for image pulls
BDocker daemon failed to start due to invalid configuration
CPulling image directly from Docker Hub without mirror
DError: registry mirror URL invalid, falling back to default registry
Attempts:
2 left
💡 Hint

Check how Docker logs registry mirror usage when configured correctly.

❓ Configuration
advanced
2:00remaining
Which Docker daemon.json configuration correctly sets up two registry mirrors?

Select the valid JSON configuration to set two registry mirrors: https://mirror1.example.com and https://mirror2.example.com.

A
{
  "registry-mirrors": ["https://mirror1.example.com" "https://mirror2.example.com"]
}
B
{
  "registry-mirrors": "https://mirror1.example.com, https://mirror2.example.com"
}
C
{
  "registry-mirrors": ["https://mirror1.example.com", "https://mirror2.example.com"]
}
D
{
  "registry-mirrors": {"mirror1": "https://mirror1.example.com", "mirror2": "https://mirror2.example.com"}
}
Attempts:
2 left
💡 Hint

Remember that JSON arrays require commas between items.

❓ Troubleshoot
advanced
2:00remaining
Why does Docker ignore the configured registry mirror and pull directly from Docker Hub?

You configured a registry mirror in daemon.json, but Docker still pulls images directly from Docker Hub. What is the most likely cause?

ADocker Hub disables mirror usage for official images.
BDocker daemon does not support registry mirrors on Linux systems.
CThe mirror URL must be set in the Dockerfile, not daemon.json.
DThe registry mirror URL is unreachable or returns errors, so Docker falls back to Docker Hub.
Attempts:
2 left
💡 Hint

Check network connectivity and mirror server health.

🔀 Workflow
expert
2:30remaining
Order the steps to configure and verify a Docker registry mirror on a Linux host

Arrange the steps below in the correct order to set up and confirm a Docker registry mirror is working.

A4,1,2,3
B1,4,2,3
C4,2,1,3
D1,2,4,3
Attempts:
2 left
💡 Hint

Think about verifying the mirror before configuring and restarting Docker.

Practice

(1/5)
1. What is the main purpose of using a registry mirror in Docker?
easy
A. To speed up image downloads by using a closer copy
B. To create new Docker images automatically
C. To secure Docker images with encryption
D. To delete unused Docker images from the local system

Solution

  1. Step 1: Understand what a registry mirror does

    A registry mirror stores copies of Docker images closer to the user to reduce download time.
  2. Step 2: Identify the main benefit

    This setup speeds up image downloads by avoiding long-distance network calls to the main registry.
  3. Final Answer:

    To speed up image downloads by using a closer copy -> Option A
  4. Quick Check:

    Registry mirror purpose = speed up downloads [OK]
Hint: Mirrors make image downloads faster by local caching [OK]
Common Mistakes:
  • Thinking mirrors create images
  • Confusing mirrors with security features
  • Assuming mirrors delete images
2. Which of the following is the correct way to add a registry mirror in Docker's daemon configuration file daemon.json?
easy
A. { "registry-mirror": ["https://mirror.example.com"] }
B. { "registry": ["https://mirror.example.com"] }
C. { "mirrors": ["https://mirror.example.com"] }
D. { "registry-mirrors": ["https://mirror.example.com"] }

Solution

  1. Step 1: Recall the correct key name for mirrors

    The Docker daemon.json uses the key "registry-mirrors" (plural) to list mirror URLs.
  2. Step 2: Match the correct JSON syntax

    The value must be an array of strings with mirror URLs, correctly formatted as shown.
  3. Final Answer:

    { "registry-mirrors": ["https://mirror.example.com"] } -> Option D
  4. Quick Check:

    Key is "registry-mirrors" with array [OK]
Hint: Use plural "registry-mirrors" key with array in daemon.json [OK]
Common Mistakes:
  • Using singular "registry-mirror" key
  • Using wrong key like "mirrors" or "registry"
  • Not using an array for URLs
3. Given the following daemon.json snippet, what will happen when Docker tries to pull an image?
{
  "registry-mirrors": ["https://mirror1.example.com", "https://mirror2.example.com"]
}
medium
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

  1. Step 1: Understand mirror priority

    Docker tries mirrors in the order listed, using the first mirror available.
  2. 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.
  3. Final Answer:

    Docker will try mirror1 first, then mirror2 if mirror1 fails -> Option A
  4. 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

  1. Step 1: Check Docker daemon reload requirement

    Changes to daemon.json require restarting the Docker daemon to take effect.
  2. Step 2: Identify common mistake

    Not restarting Docker after editing daemon.json causes the old config to remain active.
  3. Final Answer:

    Docker daemon was not restarted after editing the file -> Option C
  4. 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

  1. Step 1: Configure mirror in daemon.json

    Add the mirror URL inside the "registry-mirrors" array in Docker's daemon.json file.
  2. Step 2: Restart Docker daemon

    Restart Docker to apply the new mirror configuration so it is used for all image pulls.
  3. Final Answer:

    Add the mirror URL to daemon.json under "registry-mirrors", then restart Docker daemon -> Option B
  4. 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 unknown strong while earning +1 Grip toward your certificate.

10 questions~5 mineasy hard