Skip to content

Managing Container Resources

Don Horner edited this page May 22, 2023 · 5 revisions

Docker containers run as separate computation environments within a host system.

The host system is responsible for giving the docker container computation resources to run. As the user you have some control over this allocation. By allocating resources to docker you are preventing other programs on your host machine from using them. Increase the docker resource allocation only if necessary.

Linux

By default, Docker can use all the resources available on the machine. See the instructions under Resources to limit resources available to Docker.

MacOS

  1. Launch the Docker desktop application by going to Finder > Applications > Docker or click on the whale icon in the menu bar at the top of the screen and select Preferences.
  2. Click Resources in the side menu.
  3. Adjust the available number of CPUs, the amount of available Memory, or the available hard drive space.
  4. Click Apply and Restart.

See Docker Settings for Mac, particularly the instructions under Resources, for more details and other options.

Windows

Similarly to Linux, Docker can use all the resources available to WSL2 Virtual Machine (VM), which by default can be limited (e.g., the amount of memory WSL2 can use). To modify the defaults, you will need to change the WSL configuration options.

See Docker Settings for Windows, particularly the instructions under Resources, for more details and other options. Note that some instructions only apply if you are running Docker in Hyper-V mode (which we don't recommend).