Jump to content

Linux/Docker/Variables & Snippets: Difference between revisions

From Wiki
Marcluer (talk | contribs)
No edit summary
Marcluer (talk | contribs)
mNo edit summary
 
(One intermediate revision by the same user not shown)
Line 1: Line 1:
== List all containers and sort by memory consumption ==
<pre>
docker stats --no-stream | tail -n +2 | sort -k 4 -h -r
docker stats --no-stream --format "table {{.Name}}\t{{.CPUPerc}}\t{{.MemUsage}}" | tail -n +2 | sort -k 3 -h -r
</pre>
== Docker Host IP ==
== Docker Host IP ==
<pre>
<pre>

Latest revision as of 09:28, 6 January 2025

List all containers and sort by memory consumption

docker stats --no-stream | tail -n +2 | sort -k 4 -h -r

docker stats --no-stream --format "table {{.Name}}\t{{.CPUPerc}}\t{{.MemUsage}}" | tail -n +2 | sort -k 3 -h -r

Docker Host IP

ip -4 route list match 0/0 | cut -d' ' -f3

List all container IPs

docker ps -q | xargs -n 1 docker inspect --format '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}} {{ .Name }}' | sed 's/ \// /'