0
0
Dockerdevops~10 mins

Container resource usage stats in Docker - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the command to show real-time resource usage stats of all containers.

Docker
docker stats [1]
Drag options to blanks, or click blank then click option'
A--no-stream
B--all
C--format
D--quiet
Attempts:
3 left
💡 Hint
Common Mistakes
Using --no-stream which only shows a single snapshot
Using --quiet which suppresses output
2fill in blank
medium

Complete the command to show a single snapshot of container stats without continuous updates.

Docker
docker stats [1]
Drag options to blanks, or click blank then click option'
A--no-stream
B--no-trunc
C--format
D--all
Attempts:
3 left
💡 Hint
Common Mistakes
Using --all which shows all containers but still streams
Using --format which changes output format but not streaming
3fill in blank
hard

Fix the error in the command to display CPU and memory usage in a custom format.

Docker
docker stats --format "{{.Name}}: CPU [1], MEM {{.MemUsage}}"
Drag options to blanks, or click blank then click option'
A{{.CPUPerc}}
B{{.MemUsage}}
C{{.ID}}
D{{.Name}}
Attempts:
3 left
💡 Hint
Common Mistakes
Using {{.MemUsage}} for CPU which shows memory instead
Using {{.Name}} or {{.ID}} which are container identifiers
4fill in blank
hard

Fill both blanks to create a command that shows stats only for containers named 'webapp' and 'db'.

Docker
docker stats [1] [2]
Drag options to blanks, or click blank then click option'
Awebapp
Bdb
C--no-stream
D--all
Attempts:
3 left
💡 Hint
Common Mistakes
Using options like --all or --no-stream instead of container names
Mixing container names with options in wrong order
5fill in blank
hard

Fill all three blanks to format output showing container name, CPU %, and memory usage.

Docker
docker stats --format "[1]: CPU [2], MEM [3]"
Drag options to blanks, or click blank then click option'
A.Name
B{{.CPUPerc}}
C{{.MemUsage}}
D.ID
Attempts:
3 left
💡 Hint
Common Mistakes
Using .ID instead of .Name for container name
Omitting braces or dots in placeholders