Challenge, Medium,  on  Containers

You’ve logged into an overloaded server where CPU and RAM usage are nearly maxed out. The culprit is a resource-intensive container. Your mission: identify and stop the offending container, then launch a new one with the same image and name. Ensure the new container’s resource usage is capped between 50% and 60% of the server’s CPU and RAM.

Good luck!

Hint 1 💡

You can use docker ps to list all running containers and docker stop to stop a container by its name or ID.

Hint 2 💡

Every container on the host (including stopped ones) should have a unique name. Make sure you removed the old container before starting a new one. You can use docker ps -a to list all containers, including stopped ones and docker rm to remove a container by its name or ID.

Hint 3 💡

To limit the CPU usage of a container, you need to pass an extra flag (or two) to the docker run command. Try docker run --help and see what options are CPU-related.

Hint 4 💡

Same as with CPU, you need to pass an extra flag (or two) to the docker run command. Try docker run --help and see what options are memory-related.

Level up your Server Side game — Join 9,000 engineers who receive insightful learning materials straight to their inbox