Recall & Review
beginner
What is a memory limit in Docker?
A memory limit sets the maximum amount of memory a container can use. If the container tries to use more, it may be stopped or killed.
Click to reveal answer
beginner
What does memory reservation mean in Docker?
Memory reservation is the amount of memory that Docker guarantees to a container. It helps ensure the container has enough memory to run smoothly.
Click to reveal answer
beginner
How do you set a memory limit when running a Docker container?
Use the option
--memory followed by the limit size, for example: docker run --memory=500m myimage limits memory to 500 megabytes.Click to reveal answer
intermediate
What happens if a container exceeds its memory limit?
Docker may stop or kill the container to prevent it from using more memory than allowed, protecting the host system.
Click to reveal answer
intermediate
Why use memory reservation along with memory limits?
Memory reservation ensures the container has enough memory to run well, while the limit prevents it from using too much and affecting other containers.
Click to reveal answer
Which Docker option sets the maximum memory a container can use?
✗ Incorrect
The
--memory option sets the maximum memory limit for a container.What does
--memory-reservation do in Docker?✗ Incorrect
--memory-reservation guarantees a minimum amount of memory for the container.If a container exceeds its memory limit, what usually happens?
✗ Incorrect
Docker stops or kills containers that exceed their memory limits to protect the host.
Which is true about memory reservation?
✗ Incorrect
Memory reservation guarantees a minimum amount of memory for the container.
How do you limit a container's memory to 1 gigabyte?
✗ Incorrect
Use
--memory=1g to limit the container's memory to 1 gigabyte.Explain the difference between memory limits and memory reservations in Docker.
Think about max vs guaranteed memory.
You got /4 concepts.
Describe how to set memory limits and reservations when running a Docker container.
Recall the Docker run command options.
You got /4 concepts.