Sort by memory usage in docker stats

0 votes

Is there a way to get the Docker stats sorted by container memory usage?

I'm using the following command to show the names of the containers in a container, and I'd like to sort the results by memory usage.

docker stats --format "table {{.Name}}\t{{.Container}}\t{{.CPUPerc}}\t{{.MemUsage}}"

The following is the unsorted result.

NAME                                                                   CONTAINER           CPU %               MEM USAGE / LIMIT
kafka3.interactive.8a38c338742464ffb04d6f23fc6485391318d103            0d68b7fd49a0        1.39%               359.5 MiB / 4.833 GiB
kafka2.interactive.8a38c338742464ffb04d6f23fc6485391318d103            7e5541b0b883        1.22%               309.4 MiB / 4.833 GiB
kafka1.interactive.8a38c338742464ffb04d6f23fc6485391318d103            dff07c6d639c        0.68%               267.4 MiB / 4.833 GiB
service2.interactive.8a38c338742464ffb04d6f23fc6485391318d103          0f20a7e75823        0.06%               617.8 MiB / 4.833 GiB
consulakms.interactive.8a38c338742464ffb04d6f23fc6485391318d103        b5972262194d        3.82%               10.32 MiB / 4.833 GiB
service1.interactive.8a38c338742464ffb04d6f23fc6485391318d103          be56185a37bf        0.09%               596.3 MiB / 4.833 GiB
consumer1.interactive.8a38c338742464ffb04d6f23fc6485391318d103         05145beb209c        0.06%               574.6 MiB / 4.833 GiB
consul1.interactive.8a38c338742464ffb04d6f23fc6485391318d103           3298a8159064        0.67%               10.57 MiB / 4.833 GiB
consul3.interactive.8a38c338742464ffb04d6f23fc6485391318d103           4a1bbbd131ad        3.12%               9.664 MiB / 4.833 GiB
zookeeper2.interactive.8a38c338742464ffb04d6f23fc6485391318d103        040f00b4bbc7        0.09%               42.45 MiB / 4.833 GiB
consulbootstrap.interactive.8a38c338742464ffb04d6f23fc6485391318d103   45268a11f2f4        3.62%               11.46 MiB / 4.833 GiB
zookeeper3.interactive.8a38c338742464ffb04d6f23fc6485391318d103        331772b27079        0.12%               51.27 MiB / 4.833 GiB
consul2.interactive.8a38c338742464ffb04d6f23fc6485391318d103           77b63171e6b5        1.07%               12.59 MiB / 4.833 GiB
zookeeper1.interactive.8a38c338742464ffb04d6f23fc6485391318d103        c5ad82730598        0.08%               43.17 MiB / 4.833 GiB
service3.interactive.8a38c338742464ffb04d6f23fc6485391318d103          610da86c6949        3.79%               546.7 MiB / 4.833 GiB
squid.interactive.8a38c338742464ffb04d6f23fc6485391318d103             928ddbb197fa        0.01%               144.2 MiB / 4.833 GiB
Apr 30, 2022 in Docker by Abhijeet
• 180 points

edited 4 days ago 9 views

No answer to this question. Be the first to respond.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP