0
0
Dockerdevops~10 mins

Memory limits and reservations in Docker - Interactive Code Practice

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

Complete the code to set a memory limit of 500MB for a Docker container.

Docker
docker run --memory=[1] myapp
Drag options to blanks, or click blank then click option'
A500MB
B500mb
C500m
D500
Attempts:
3 left
💡 Hint
Common Mistakes
Using uppercase 'MB' which Docker does not recognize.
Omitting the suffix, which defaults to bytes and is too small.
2fill in blank
medium

Complete the code to reserve 200MB of memory for a Docker container.

Docker
docker run --memory-reservation=[1] myapp
Drag options to blanks, or click blank then click option'
A200m
B200
C200mb
D200MB
Attempts:
3 left
💡 Hint
Common Mistakes
Using uppercase 'MB' which is invalid.
Not specifying any suffix, which defaults to bytes.
3fill in blank
hard

Fix the error in the command to limit memory to 1GB.

Docker
docker run --memory=[1] myapp
Drag options to blanks, or click blank then click option'
A1g
B1G
C1GB
D1000m
Attempts:
3 left
💡 Hint
Common Mistakes
Using uppercase 'GB' or 'G' which causes errors.
Using '1000m' which is 1000 megabytes, not exactly 1 gigabyte.
4fill in blank
hard

Fill both blanks to set a memory limit of 750MB and a reservation of 500MB.

Docker
docker run --memory=[1] --memory-reservation=[2] myapp
Drag options to blanks, or click blank then click option'
A750m
B500m
C750MB
D500MB
Attempts:
3 left
💡 Hint
Common Mistakes
Using uppercase 'MB' which Docker does not accept.
Mixing suffixes or omitting them.
5fill in blank
hard

Fill all three blanks to set a memory limit of 2GB, a reservation of 1GB, and swap memory limit of 3GB.

Docker
docker run --memory=[1] --memory-reservation=[2] --memory-swap=[3] myapp
Drag options to blanks, or click blank then click option'
A2g
B1g
C3g
D3000m
Attempts:
3 left
💡 Hint
Common Mistakes
Using uppercase 'G' or 'GB' suffixes.
Using megabytes instead of gigabytes for large values.