2. Which of these is the correct syntax to list all local Docker images?
easy
A. docker list images
B. docker image list -a
C. docker show images
D. docker images
Solution
Step 1: Recall the exact command for listing images
The standard command is docker images to list local images.
Step 2: Check other options for correctness
docker list images and docker show images are invalid commands. docker image list -a is a valid command but lists all images including intermediate layers, which is more advanced than the basic listing.
Final Answer:
docker images -> Option D
Quick Check:
Correct syntax = docker images [OK]
Hint: Use exact command: docker images, no extra words [OK]
Common Mistakes:
Adding extra words like 'list' or 'show'
Using incorrect flags or subcommands
Confusing 'image' and 'images'
3. What will be the output of the command docker images if you have two images named app with tags v1 and v2?
medium
A. It will list images but without tags
B. It will list only the latest image
C. It will list both images with their tags and IDs
D. It will show an error about duplicate image names
Solution
Step 1: Understand how Docker images are listed
The docker images command shows all images, including multiple tags for the same image name.
Step 2: Confirm output details
Both images named app with tags v1 and v2 will appear separately with their tags and image IDs.
Final Answer:
It will list both images with their tags and IDs -> Option C
Quick Check:
docker images lists all tags separately [OK]
Hint: Each tag is a separate image entry in the list [OK]
Common Mistakes:
Assuming only one tag shows
Expecting an error for duplicate names
Thinking tags are hidden
4. You ran docker images -l but got an error. What is the problem?
medium
A. The -l flag is invalid for docker images
B. You need to run the command as root
C. You must specify an image name with -l
D. The Docker daemon is not running
Solution
Step 1: Check the meaning of -l flag
The -l flag is not a valid option for docker images. It causes a syntax error.
Step 2: Consider other possible causes
Running as root or daemon status would cause different errors. The -l flag does not require an image name.
Final Answer:
The -l flag is invalid for docker images -> Option A
Quick Check:
Invalid flag = error [OK]
Hint: Use only supported flags with docker images [OK]
Common Mistakes:
Assuming -l lists latest images
Thinking root permission fixes flag errors
Confusing daemon errors with syntax errors
5. You want to list all local Docker images but only show the repository and tag columns. Which command should you use?
hard
A. docker images --filter "repository,tag"
B. docker images --format "{{.Repository}}:{{.Tag}}"
C. docker images --only repository tag
D. docker images --columns repository tag
Solution
Step 1: Understand formatting option in docker images
The --format flag lets you customize output columns using Go template syntax.
Step 2: Check each option's validity
--format "{{.Repository}}:{{.Tag}}" correctly formats output to show only repository and tag. Other options are invalid or unsupported.
Final Answer:
docker images --format "{{.Repository}}:{{.Tag}}" -> Option B
Quick Check:
Use --format with Go templates for custom columns [OK]
Hint: Use --format with {{.Repository}} and {{.Tag}} [OK]
Common Mistakes:
Using unsupported flags like --only or --columns
Confusing --filter with formatting
Incorrect template syntax
Recommended
Ready to prove it?
Pass the test and this pattern moves unknownstrongwhile earning +1 Grip toward your certificate.