EXPLOREYOURBRAINISM

Just shares about life-networking-programing-ebook-computer-*nix-music-religion and more…

Currently Viewing Posts Tagged docker

Cek Penggunaan Memory Docker

Untuk mengecek penggunaan memory (RAM) oleh Docker, kamu bisa menggunakan beberapa perintah berikut:

1. docker stats (Real-time Monitoring)

Perintah ini menampilkan statistik live untuk semua container yang sedang berjalan, termasuk penggunaan CPU, memory, network, dan disk.

docker stats

Contoh output:

CONTAINER ID NAME CPU % MEM USAGE / LIMIT MEM % NET I/O BLOCK I/O PIDS abc123xyz456 nginx 0.50% 50MiB / 1.952GiB 2.50% 1.2kB / 0B 0B / 0B 3

2. docker stats --no-stream (Sekali Jalankan)

Jika ingin melihat statistik sekali saja (tidak real-time):

docker stats --no-stream

3. Per Container Detail

Untuk detail lebih spesifik tentang memory sebuah container (termasuk limit dan cache):

docker inspect <container_id> --format='{{.HostConfig.Memory}} {{.HostConfig.MemorySwap}}'

Atau untuk melihat penggunaan memory secara detail:

docker inspect <container_id> | grep -i memory

4. System-wide Docker Memory Usage

Jika ingin melihat total penggunaan memory oleh semua container Docker di sistem, bisa gunakan:

docker stats --no-stream --format "table {{.Container}}\t{{.Name}}\t{{.MemUsage}}" | awk '{print $3}' | grep -v "MEM" | awk '{s+=$1} END {print s}'

5. Melalui docker system df (Disk & Cache)

Untuk melihat penggunaan disk dan cache oleh Docker (tidak termasuk memory):

docker system df

6. Melalui top/htop di Host

Jika ingin melihat proses Docker di level host:

top | grep docker # atau htop

Catatan:

Semoga membantu dan bermanfaat

  • Recent Posts

  • Recent Comments

  • Archives