Complete the command to limit the CPU usage of a Docker container to 50%.
docker run --cpus=[1] alpine top--cpus flag.The --cpus option limits the CPU usage. Setting it to 0.5 means the container can use up to 50% of one CPU.
Complete the command to limit the memory usage of a Docker container to 256 megabytes.
docker run --memory=[1] alpine topmb or mbs which are invalid units.The --memory option limits the memory. The correct suffix for megabytes is m, so 256m means 256 megabytes.
Fix the error in the command that tries to limit memory but uses an invalid unit.
docker run --memory=[1] alpine topmb or mbs as units.The correct memory unit is m for megabytes. 512m is valid, while 512mb or 512mbs are invalid.
Fill both blanks to limit CPU to 1.5 cores and memory to 1 gigabyte.
docker run --cpus=[1] --memory=[2] alpine top
1.0g which is valid but less common.2 for memory which lacks a unit.--cpus=1.5 limits CPU to one and a half cores. --memory=1g limits memory to 1 gigabyte.
Fill all three blanks to run a container with CPU limit 0.75, memory limit 512 megabytes, and a restart policy of always.
docker run --cpus=[1] --memory=[2] --restart=[3] alpine top
512mb instead of 512m.on-failure when the question asks for always.The CPU limit is 0.75, memory limit is 512m for 512 megabytes, and the restart policy always makes the container restart automatically if it stops.