Join our Discord Server
Ajeet Raina Ajeet Singh Raina is a former Docker Captain, Community Leader and Distinguished Arm Ambassador. He is a founder of Collabnix blogging site and has authored more than 700+ blogs on Docker, Kubernetes and Cloud-Native Technology. He runs a community Slack of 9800+ members and discord server close to 2600+ members. You can follow him on Twitter(@ajeetsraina).

What is Resource Saver Mode in Docker Desktop and what problem does it solve?

4 min read

Resource Saver mode is a new feature introduced in Docker Desktop 4.22 that allows you to conserve resources by reducing the amount of memory and CPU that Docker uses. It is a game-changer for Docker Desktop users, providing a valuable solution to the challenge of managing resource consumption during application development. By intelligently adjusting resource allocation, prioritizing active containers, and dynamically scaling based on demand, Resource Saver Mode optimizes efficiency, enhances performance, and simplifies the development workflow.

Whether you’re a solo developer or part of a team, integrating Resource Saver Mode into your Docker Desktop experience can lead to smoother, more productive, and energy-efficient development processes. As Docker continues to evolve and refine its tools, features like Resource Saver Mode demonstrate the company’s commitment to empowering developers with innovative solutions that make containerization more accessible and efficient than ever before.

Please Note: Resource Saver is currently an experimental feature. To access this feature, make sure you have turned on access to experimental features in settings.

Benefits of Resource Saver Mode

The resource saver feature is meant to significantly reduce Docker Desktop’s memory and CPU usage on the host when no containers are running, to improve overall user experience. It will reduce memory utilization by 2GBs (or more) when Docker Desktop goes idle. In the earlier version of Docker Desktop v4.21, the feature would simply pause processes in the Docker Desktop Linux VM, but in v4.22, Docker Team improved it to shutdown the Docker Desktop Linux VM.

When Docker Desktop is paused, the Linux VM running Docker Engine is paused, the current state of all your containers are saved in memory, and all processes are frozen. This reduces the CPU and memory usage and helps you retain a longer battery life on your laptop.You can either manually pause Docker Desktop or turn on the Resource Saver feature which automatically pauses Docker Desktop when no container is running.

Here are a few benefits of integrating Resource Saver Mode to your Docker Desktop

1. Enhanced Performance

One of the most significant benefits of Resource Saver Mode is the improved performance it offers during development. By intelligently managing resource allocation, it ensures that active containers receive the necessary resources to operate efficiently, leading to faster build times and better application responsiveness.

2. Optimized Resource Utilization

Resource Saver Mode prevents resource wastage by dynamically adjusting resource allocation based on container activity. This ensures that developers can run multiple containers simultaneously without worrying about resource conflicts or system slowdowns.

2. Efficient Multitasking

For developers who often work on multiple projects or need to switch between different containers, Resource Saver Mode optimizes multitasking. It guarantees that the right resources are allocated to the right containers, allowing for a seamless transition between development tasks.

Previously, Docker Desktop introduced some CPU optimizations of Resource Saver, which, at the time of writing, are already saving up to a staggering 38,500 CPU hours every single day across all Docker Desktop users.

3. Improved Battery Life (Laptop Users)

Laptop users can benefit from extended battery life when using Docker Desktop with Resource Saver Mode. By preventing unnecessary resource consumption, the mode helps reduce power usage, ultimately prolonging the battery life of portable devices.

4. Simplified Development Workflow

With Resource Saver Mode, developers can focus on writing code and building applications without being burdened by manual resource management. The mode’s automated adjustments ensure that containers receive the appropriate resources, freeing developers from the need to constantly monitor and adjust settings.

How to Enable Resource Saver Mode

Resource Saver mode can be enabled in the Docker Desktop settings. To do this, open the Docker Desktop app and click on the Settings icon in the top right corner. Then, click on the Features in Development tab and choose the Experimental Feature tab to enable Resource Saver Mode.

Image1

Is Resource Saver available for Windows?

Yes, Resource Saver is available for both Windows Hyper-V and MacOS. It optimises Docker Desktop’s usage of your system resources when no containers are running. To access this feature, make sure you have turned on access to experimental features in settings.

What happens when Resource Saver Mode is enabled

When Resource Saver mode is enabled, Docker turns off the Linux VM when Docker Desktop goes idle, but once Docker Desktop gets busy (e.g., user runs a container), then the container will get the same amount of CPU & Memory as it would have without resource saver enabled.

How Docker Desktop exits Resource Saver Mode

Docker Desktop exits resource saver mode automatically whenever a Docker command is executed that requires the Docker engine to take action. Please note that Docker commands that retrieve status such as docker ps, docker image ls, etc. do not require exit from resource saver mode as Docker Desktop cache these while entering resource saver mode, before shutting off the Linux VM.

How does it work?

To see this feature in action, start Docker Desktop and leave it idle for 30 seconds with no containers running. A leaf will appear over the whale icon in your Docker Desktop menu and the sidebar of the Docker Desktop dashboard, indicating that Resource Saver mode is activated.

Image6

How to Configure Resource Saver Mode Delay

In addition to enabling Resource Saver Mode in the Docker Desktop settings, you can also configure the delay for entry into resource saver mode. This is useful if you want to give Docker Desktop a longer period of time to finish any pending tasks before it is paused.

To configure the delay for entry into resource saver mode, you can edit the settings.json file and set the autoPauseTimeoutSeconds property to a desired delay in seconds. The default value is 30 seconds, but you can set it to any value you like.

For example, to set the delay to 60 seconds, you would add the following line to the settings.json file:

"autoPauseTimeoutSeconds": 60


Once you have saved the settings.json file, Docker Desktop will pause after 60 seconds of inactivity. This will help to reduce the amount of resources that Docker Desktop uses, while still allowing you to make changes to your code and see the results in real time.

Why do a few of my containers start up slowly?

On exit from the resource saver mode, the first container starts slowly as Docker Desktop is restarting the Linux VM in the background (5->10 secs). Thereafter all containers start instantaneously as usual.

Resource Saver with Limited Resources

If you’re running Docker on a machine with limited resources, you may want to consider enabling Resource Saver mode. This can help to improve the performance of your machine and enable more efficient multitasking between Docker and other applications.

Facing issues?

You can run this diagnostics command while in the broken state and submit it while raising a Github issue here.

/Applications/Docker.app/Contents/MacOS/com.docker.diagnose gather -upload 

Further Readings:

Have Queries? Join https://launchpass.com/collabnix

Ajeet Raina Ajeet Singh Raina is a former Docker Captain, Community Leader and Distinguished Arm Ambassador. He is a founder of Collabnix blogging site and has authored more than 700+ blogs on Docker, Kubernetes and Cloud-Native Technology. He runs a community Slack of 9800+ members and discord server close to 2600+ members. You can follow him on Twitter(@ajeetsraina).
Join our Discord Server
Index