Challenge - 5 Problems
Docker Tagging Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
💻 Command Output
intermediate1:30remaining
What is the output of this Docker build command?
You run the command
docker build -t myapp:1.0 . in a directory with a valid Dockerfile. What will be the tag of the built image?Docker
docker build -t myapp:1.0 .
Attempts:
2 left
💡 Hint
The -t option sets the tag explicitly.
✗ Incorrect
Using -t with 'myapp:1.0' tags the image exactly as 'myapp:1.0'. Without -t, Docker defaults to 'latest'.
❓ Configuration
intermediate1:30remaining
Which Dockerfile instruction sets the image tag during build?
You want to set the image tag inside the Dockerfile itself during build time. Which instruction achieves this?
Attempts:
2 left
💡 Hint
Think about where tags are applied in Docker workflow.
✗ Incorrect
Docker image tags are assigned during the build command, not inside the Dockerfile. Dockerfile instructions configure the image content, not its tag.
🔀 Workflow
advanced2:00remaining
How to tag the same image with multiple tags during build?
You want to build a Docker image and tag it as both 'myapp:1.0' and 'myapp:latest' in one command. Which command achieves this?
Attempts:
2 left
💡 Hint
Multiple -t options can be used.
✗ Incorrect
Docker build supports multiple -t options to assign multiple tags to the same image in one build.
❓ Troubleshoot
advanced2:00remaining
Why does this Docker build command fail to tag the image?
You run
docker build . -t myapp:1.0 but the image is not tagged as expected. What is the problem?Docker
docker build . -t myapp:1.0
Attempts:
2 left
💡 Hint
Check the order of options and arguments in the command.
✗ Incorrect
Docker build expects options like -t before the build context argument. Placing -t after '.' causes it to be ignored.
✅ Best Practice
expert2:30remaining
What is the best practice for tagging images in CI/CD pipelines?
In a CI/CD pipeline, you want to tag Docker images to track builds uniquely and also have a stable tag for deployment. Which tagging strategy is best?
Attempts:
2 left
💡 Hint
Consider traceability and stable references.
✗ Incorrect
Using commit SHA tags allows traceability to exact code versions, while 'latest' provides a stable tag for deployment. This is a common best practice.