Create VM using docker-machine
with 2 vCPUs.
Notes:
- Use top command1 to observe cpu loads,
- Use stress image for this exercise.
- Fully load single CPU core of your choice
docker run -it --rm progrium/stress --cpu 1
- Verify that only one core is under load
- Run container again but load both cpus
docker run -it --rm progrium/stress --cpu 2
- Modify CPUs that container can access directly in
/sys/fs/cgroup/
- Run 2 containers, 1 with cpushare 1024, second with 2048
- observe how much resources each container consumes
docker run -c 1024 -d progrium/stress --cpu 2
docker run -c 2048 -d progrium/stress --cpu 2
- Ensure that container won't consume more CPU resources than specified no matter if its the only container on the host
- See
cpushare
andcpuquota
- See
- Experiment with multiple containers
* Run container (from stress image) with memory limited to `128M`
* Verify that container can't consume more memory than allocated
Footnotes
-
set
TERM=xterm
to enable top inboot2docker
image ↩