0
0
Dockerdevops~10 mins

Container metrics collection 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 list all running Docker containers.

Docker
docker [1]
Drag options to blanks, or click blank then click option'
Astart
Brun
Cps
Dstop
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'docker run' instead of 'docker ps' to list containers.
Using 'docker start' which starts a stopped container but does not list them.
2fill in blank
medium

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

Docker
docker [1]
Drag options to blanks, or click blank then click option'
Astats
Blogs
Cinspect
Dtop
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'docker logs' which shows container logs, not metrics.
Using 'docker inspect' which shows detailed info but not live stats.
3fill in blank
hard

Fix the error in the command to get stats for a specific container named 'webapp'.

Docker
docker stats [1]
Drag options to blanks, or click blank then click option'
Awebapp
B--name webapp
C-container webapp
Dcontainer webapp
Attempts:
3 left
💡 Hint
Common Mistakes
Adding unnecessary flags like '--name' which is not valid here.
Using incorrect flags like '-container' or 'container' which cause errors.
4fill in blank
hard

Fill both blanks to create a command that outputs container stats in JSON format and limits output to 5 updates.

Docker
docker stats --format '[1]' --no-stream --[2] 5
Drag options to blanks, or click blank then click option'
A"{{.Name}}: CPU {{.CPUPerc}}, Mem {{.MemUsage}}"
Bstream
Climit
Djson
Attempts:
3 left
💡 Hint
Common Mistakes
Using '--json' which is not a valid flag for docker stats.
Using '--limit' which is not a recognized option.
5fill in blank
hard

Fill all three blanks to create a command that filters stats for containers with names starting with 'db' and outputs only CPU percentage.

Docker
docker stats --format '{{{{.Name}}}}: {{{{.[1]' --filter name=[2] --no-stream | grep '^[3]'
Drag options to blanks, or click blank then click option'
ACPUPerc
Bdb
DMemUsage
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'MemUsage' instead of 'CPUPerc' for CPU stats.
Not using the correct filter syntax for container names.