0
0
Dockerdevops~20 mins

Image tags and versioning in Docker - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Docker Image Tagging Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
💻 Command Output
intermediate
1:30remaining
Understanding Docker image tag output
What is the output of the command docker images --format "{{.Repository}}:{{.Tag}}" | grep '^myapp:' if the local images are:
  • myapp:latest
  • myapp:1.0
  • myapp:1.1
  • otherapp:2.0
Docker
docker images --format "{{.Repository}}:{{.Tag}}" | grep '^myapp:'
ANo output
B
myapp:latest
myapp:1.0
myapp:1.1
otherapp:2.0
Cotherapp:2.0
D
myapp:latest
myapp:1.0
myapp:1.1
Attempts:
2 left
💡 Hint
The grep command filters lines starting with 'myapp:'
🧠 Conceptual
intermediate
1:30remaining
Docker image tag best practice
Which of the following is the best reason to avoid using the latest tag in production deployments?
AThe latest tag is slower to download than versioned tags
BThe latest tag always points to the newest image, which can cause unexpected updates breaking the app
CThe latest tag cannot be pushed to Docker Hub
DThe latest tag uses more disk space on the host
Attempts:
2 left
💡 Hint
Think about stability and predictability in production
🔀 Workflow
advanced
2:00remaining
Tagging and pushing multiple image versions
You built a Docker image locally with ID abc123. You want to tag it as myapp:1.0 and myapp:stable and push both tags to Docker Hub. Which sequence of commands correctly does this?
A
docker tag myapp:1.0 abc123
docker push myapp:1.0
 docker push myapp:stable
B
docker push abc123 myapp:1.0
 docker push abc123 myapp:stable
C
docker tag abc123 myapp:1.0
docker tag abc123 myapp:stable
docker push myapp:1.0
docker push myapp:stable
D
docker build -t myapp:1.0 .
docker push myapp:stable
Attempts:
2 left
💡 Hint
Remember to tag the image ID before pushing tags
Troubleshoot
advanced
1:30remaining
Troubleshooting image pull failure with tags
You run docker pull myapp:2.0 but get the error manifest for myapp:2.0 not found. What is the most likely cause?
AThe tag '2.0' does not exist in the remote repository
BThe image name 'myapp' is invalid
CYou have no internet connection
DDocker daemon is not running
Attempts:
2 left
💡 Hint
Check if the tag exists remotely
Best Practice
expert
2:00remaining
Versioning strategy for Docker images in CI/CD
In a CI/CD pipeline, which tagging strategy best supports traceability and rollback of Docker images?
ATag images with the Git commit SHA and push with that tag
BAlways tag images as 'latest' to simplify deployment
CUse timestamps as tags without linking to source code
DTag images only with semantic version numbers like 1.0, 1.1
Attempts:
2 left
💡 Hint
Think about linking image versions to exact code changes