0
0
Dockerdevops~20 mins

Setting up private registry in Docker - Practice Exercises

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Private Registry Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
💻 Command Output
intermediate
2:00remaining
Docker command to start a private registry
What is the output of the command when you start a Docker private registry with the following command?

docker run -d -p 5000:5000 --name registry registry:2

Assume Docker is installed and the command runs successfully.
Docker
docker run -d -p 5000:5000 --name registry registry:2
AA container ID string is printed, indicating the registry container started in detached mode.
BError: image 'registry:2' not found locally and no pull access.
CThe command outputs 'Registry started on port 5000'.
DThe command outputs 'Permission denied' due to port binding.
Attempts:
2 left
💡 Hint
Detached mode (-d) returns the container ID if successful.
Configuration
intermediate
2:00remaining
Configuring Docker daemon to trust insecure registry
You want Docker on your client machine to trust a private registry running on localhost:5000 without TLS. Which configuration snippet should you add to /etc/docker/daemon.json to allow this?
A
{
  "registry-mirrors": ["http://localhost:5000"]
}
B
{
  "trusted-registries": ["localhost:5000"]
}
C
{
  "allow-insecure": true
}
D
{
  "insecure-registries": ["localhost:5000"]
}
Attempts:
2 left
💡 Hint
Docker uses 'insecure-registries' key for this purpose.
🔀 Workflow
advanced
3:00remaining
Steps to push an image to a private registry
Which sequence of commands correctly pushes a local Docker image named myapp:latest to a private registry running on localhost:5000?
A4,3,1,2
B4,1,3,2
C1,4,3,2
D3,4,1,2
Attempts:
2 left
💡 Hint
You must build the image first, then login, tag, and push.
Troubleshoot
advanced
2:00remaining
Diagnosing Docker push failure to private registry
You try to push an image to your private registry at localhost:5000 but get the error:

denied: requested access to the resource is denied

What is the most likely cause?
AYou forgot to login to the private registry before pushing.
BDocker daemon is not configured to allow insecure registries.
CThe image name is missing the registry prefix.
DThe private registry container is not running.
Attempts:
2 left
💡 Hint
Check if the image name includes the registry address.
Best Practice
expert
3:00remaining
Securing a private Docker registry with TLS
Which of the following is the best practice to secure a private Docker registry running on your server?
ARun the registry without TLS and configure clients to use insecure registries.
BRun the registry behind a reverse proxy that handles TLS termination with valid certificates.
CRun the registry with self-signed TLS certificates and configure clients to trust them.
DUse HTTP only and restrict access by IP firewall rules.
Attempts:
2 left
💡 Hint
Using a reverse proxy with valid TLS certificates is a common secure approach.