Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Docker desktop on linux is using a lot of ram

I’m running Docker desktop on Ubuntu 22.04. Every time I start it, it eats a lot of 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.

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.

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

Well, Docker uses all allocated memory at start, please see
https://github.com/docker/for-mac/issues/4229

You can set memory Limit on:

Dodcker Dashboard >> Settings >> Resources >> Apply and Restart
enter image description here

Otherwise, if you want to check how Resources are splitted between running container,

run docker stats to see memory usage of current running containers

See 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
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading