docker / for-win

Bug reports for Docker Desktop for Windows
https://www.docker.com/products/docker#/windows
1.87k stars 288 forks source link

docker desktop backend high memory usage #13668

Open phivanloi opened 1 year ago

phivanloi commented 1 year ago

Description

after run a day. My server is high memory with docker desktop backend. image

Reproduce

run a day

Expected behavior

fix memory usage

docker version

Client:
 Version:    24.0.5
 Context:    default
 Debug Mode: false
 Plugins:
  buildx: Docker Buildx (Docker Inc.)
    Version:  v0.11.2-desktop.1
    Path:     C:\Program Files\Docker\cli-plugins\docker-buildx.exe
  compose: Docker Compose (Docker Inc.)
    Version:  v2.20.2-desktop.1
    Path:     C:\Program Files\Docker\cli-plugins\docker-compose.exe
  dev: Docker Dev Environments (Docker Inc.)
    Version:  v0.1.0
    Path:     C:\Program Files\Docker\cli-plugins\docker-dev.exe
  extension: Manages Docker extensions (Docker Inc.)
    Version:  v0.2.20
    Path:     C:\Program Files\Docker\cli-plugins\docker-extension.exe
  init: Creates Docker-related starter files for your project (Docker Inc.)
    Version:  v0.1.0-beta.6
    Path:     C:\Program Files\Docker\cli-plugins\docker-init.exe
  sbom: View the packaged-based Software Bill Of Materials (SBOM) for an image (Anchore Inc.)
    Version:  0.6.0
    Path:     C:\Program Files\Docker\cli-plugins\docker-sbom.exe
  scan: Docker Scan (Docker Inc.)
    Version:  v0.26.0
    Path:     C:\Program Files\Docker\cli-plugins\docker-scan.exe
  scout: Command line tool for Docker Scout (Docker Inc.)
    Version:  0.20.0
    Path:     C:\Program Files\Docker\cli-plugins\docker-scout.exe

Server:
 Containers: 75
  Running: 75
  Paused: 0
  Stopped: 0
 Images: 40
 Server Version: 24.0.5
 Storage Driver: overlay2
  Backing Filesystem: extfs
  Supports d_type: true
  Using metacopy: false
  Native Overlay Diff: true
  userxattr: false
 Logging Driver: json-file
 Cgroup Driver: cgroupfs
 Cgroup Version: 2
 Plugins:
  Volume: local
  Network: bridge host ipvlan macvlan null overlay
  Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog
 Swarm: inactive
 Runtimes: io.containerd.runc.v2 runc
 Default Runtime: runc
 Init Binary: docker-init
 containerd version: 3dce8eb055cbb6872793272b4f20ed16117344f8
 runc version: v1.1.7-0-g860f061
 init version: de40ad0
 Security Options:
  seccomp
   Profile: unconfined
  cgroupns
 Kernel Version: 5.15.49-linuxkit-pr
 Operating System: Docker Desktop
 OSType: linux
 Architecture: x86_64
 CPUs: 12
 Total Memory: 49.99GiB
 Name: docker-desktop
 ID: f5bb2eae-4487-423b-a8f6-72bc2902c9d6
 Docker Root Dir: /var/lib/docker
 Debug Mode: false
 HTTP Proxy: http.docker.internal:3128
 HTTPS Proxy: http.docker.internal:3128
 No Proxy: hubproxy.docker.internal
 Experimental: false
 Insecure Registries:
  hubproxy.docker.internal:5555
  127.0.0.0/8
 Live Restore Enabled: false

docker info

Client:
 Version:    24.0.5
 Context:    default
 Debug Mode: false
 Plugins:
  buildx: Docker Buildx (Docker Inc.)
    Version:  v0.11.2-desktop.1
    Path:     C:\Program Files\Docker\cli-plugins\docker-buildx.exe
  compose: Docker Compose (Docker Inc.)
    Version:  v2.20.2-desktop.1
    Path:     C:\Program Files\Docker\cli-plugins\docker-compose.exe
  dev: Docker Dev Environments (Docker Inc.)
    Version:  v0.1.0
    Path:     C:\Program Files\Docker\cli-plugins\docker-dev.exe
  extension: Manages Docker extensions (Docker Inc.)
    Version:  v0.2.20
    Path:     C:\Program Files\Docker\cli-plugins\docker-extension.exe
  init: Creates Docker-related starter files for your project (Docker Inc.)
    Version:  v0.1.0-beta.6
    Path:     C:\Program Files\Docker\cli-plugins\docker-init.exe
  sbom: View the packaged-based Software Bill Of Materials (SBOM) for an image (Anchore Inc.)
    Version:  0.6.0
    Path:     C:\Program Files\Docker\cli-plugins\docker-sbom.exe
  scan: Docker Scan (Docker Inc.)
    Version:  v0.26.0
    Path:     C:\Program Files\Docker\cli-plugins\docker-scan.exe
  scout: Command line tool for Docker Scout (Docker Inc.)
    Version:  0.20.0
    Path:     C:\Program Files\Docker\cli-plugins\docker-scout.exe

Server:
 Containers: 75
  Running: 75
  Paused: 0
  Stopped: 0
 Images: 40
 Server Version: 24.0.5
 Storage Driver: overlay2
  Backing Filesystem: extfs
  Supports d_type: true
  Using metacopy: false
  Native Overlay Diff: true
  userxattr: false
 Logging Driver: json-file
 Cgroup Driver: cgroupfs
 Cgroup Version: 2
 Plugins:
  Volume: local
  Network: bridge host ipvlan macvlan null overlay
  Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog
 Swarm: inactive
 Runtimes: io.containerd.runc.v2 runc
 Default Runtime: runc
 Init Binary: docker-init
 containerd version: 3dce8eb055cbb6872793272b4f20ed16117344f8
 runc version: v1.1.7-0-g860f061
 init version: de40ad0
 Security Options:
  seccomp
   Profile: unconfined
  cgroupns
 Kernel Version: 5.15.49-linuxkit-pr
 Operating System: Docker Desktop
 OSType: linux
 Architecture: x86_64
 CPUs: 12
 Total Memory: 49.99GiB
 Name: docker-desktop
 ID: f5bb2eae-4487-423b-a8f6-72bc2902c9d6
 Docker Root Dir: /var/lib/docker
 Debug Mode: false
 HTTP Proxy: http.docker.internal:3128
 HTTPS Proxy: http.docker.internal:3128
 No Proxy: hubproxy.docker.internal
 Experimental: false
 Insecure Registries:
  hubproxy.docker.internal:5555
  127.0.0.0/8
 Live Restore Enabled: false

Diagnostics ID

7A530F83-53E2-4E08-B9D7-304A1C2DF643

Additional Info

No response

lorenrh commented 1 year ago

Hello, what version of Docker Desktop are you using?

phivanloi commented 1 year ago

Hello, what version of Docker Desktop are you using?

Dear Lorenrh image

mooyg commented 1 year ago

I have the same issue where it's using up all the memory from my wsl vm image the containers don't seem to use any significant ram but just the docker i guess. I tried adding memory constraint in the wsl.conf for docker-desktop inside linux but it didn't work. Can't change all VMs memory limit since I am using wsl for other work too

phivanloi commented 1 year ago

I have the same issue where it's using up all the memory from my wsl vm image the containers don't seem to use any significant ram but just the docker i guess. I tried adding memory constraint in the wsl.conf for docker-desktop inside linux but it didn't work. Can't change all VMs memory limit since I am using wsl for other work too

about five day i will restart docker desktop to clean high memory usage

rg9400 commented 1 year ago

This has been a frustrating issue for me as well. I have 128GB of RAM, and somehow, Docker Desktop + WSL are gobbling up all of it. The actual RAM usage for containers is minimal in comparison (pulling data from Grafana using the Docker plugin). I suspect the 48GB RAM limit I set in my .wslconfig is being used by both Docker Desktop and WSL entirely, and the autoMemoryReclaim is not working.

As others mentioned, I need to restart Docker pretty much every 5 days. I have noticed this issue since the release of 4.19 fwiw (https://github.com/docker/for-win/issues/13393#issuecomment-1518676215)

Issue persists in 4.23.0

[wsl2]
memory=48GB # Limits VM memory in WSL2 to 64GB
kernel=C:\\Kernel\\bzImage

[experimental]
autoMemoryReclaim=gradual

image

image

assassinliujie commented 11 months ago

I'm facing this problem too. I have to reboot to solve this problem

Smankusors commented 9 months ago

this seems duplicate of https://github.com/docker/for-win/issues/13589 🤔