简体   繁体   English

Docker linux 上的桌面正在使用大量内存

[英]Docker desktop on linux is using a lot of ram

I'm running Docker desktop on Ubuntu 22.04.我在 Ubuntu 22.04 上运行 Docker 桌面。 Every time I start it, it eats a lot of RAM.每次启动它时,它都会占用大量 RAM。

    PID USER     %MEM COMMAND
 135264 user      26.0 qemu-system-x86_64 -accel kvm -cpu host -machine q35 -m 3849 -smp 8 -kernel /opt/docker-desktop/linuxkit/kernel -append page_poison=1 vsyscall=emulate panic=1 nospec_store_bypass_disable noibrs noibpb no_stf_barrier mitigations=off linuxkit.unified_cgroup_hierarchy=1    vpnkit.connect=tcp+bootstrap+client://gateway.docker.internal:35817/95d4e7d4090b2d25b84ed2f2bd2e54523bafd0dfc2e2388838f04b9d045e0fe2 vpnkit.disable=osxfs-data console=ttyS0 -initrd /opt/docker-desktop/linuxkit/initrd.img -serial pipe:/tmp/qemu-console1696356651/fifo -drive if=none,file=/home/lev/.docker/desktop/vms/0/data/Docker.raw,format=raw,id=hd0 -device virtio-blk-pci,drive=hd0,serial=dummyserial -netdev user,id=net0,ipv6=off,net=192.168.65.0/24,dhcpstart=192.168.65.9 -device virtio-net-pci,netdev=net0 -vga none -nographic -monitor none -object memory-backend-memfd,id=mem,size=3849M,share=on -numa node,memdev=mem -chardev socket,id=char0,path=virtiofs.sock0 -device vhost-user-fs-pci,queue-size=1024,chardev=char0,tag=virtiofs0
  10422 user       2.3 /snap/firefox/1883/usr/lib/firefox/firefox
  ...

While docker ps shows that there are no containers running.docker ps显示没有容器在运行。

I've noticed that there is a mention of 3849M of memory in the command but I can't be entirely sure if it's related, plus it eats way more than 4 gigs.我注意到命令中提到了 memory 的 3849M,但我不能完全确定它是否相关,而且它吃掉了超过 4 个演出。

Well, Docker uses all allocated memory at start, please see https://github.com/docker/for-mac/issues/4229那么,Docker 在开始时使用所有分配的 memory,请参阅https://github.com/docker/for-mac/issues/4229

You can set memory Limit on:您可以设置 memory 限制:

Dodcker Dashboard >> Settings >> Resources >> Apply and Restart Dodcker 仪表板 >> 设置 >> 资源 >> 应用并重启在此处输入图像描述

Otherwise, if you want to check how Resources are splitted between running container,否则,如果您想检查资源是如何在运行的容器之间分配的,

run docker stats to see memory usage of current running containers运行docker stats查看当前运行容器的 memory 使用情况

See https://docs.docker.com/engine/reference/commandline/stats/参见https://docs.docker.com/engine/reference/commandline/stats/

For Example:例如:

CONTAINER ID   NAME                                  CPU %     MEM USAGE / LIMIT     MEM %     NET I/O          BLOCK I/O        PIDS
db6115785a9e   001_jan_twit   0.00%     35.71MiB / 7.774GiB   0.45%     38.6MB / 659kB   16.4kB / 222MB   2

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM