Jump to content

Linux/Docker/Variables & Snippets: Difference between revisions

From Wiki
Marcluer (talk | contribs)
mNo edit summary
Marcluer (talk | contribs)
mNo edit summary
 
Line 2: Line 2:
<pre>
<pre>
docker stats --no-stream | tail -n +2 | sort -k 4 -h -r
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>
</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/ \// /'