Linux/Docker/Variables & Snippets: Difference between revisions

From Wiki
< Linux‎ | Docker
No edit summary
No edit summary
 
Line 2: Line 2:
<pre>
<pre>
ip -4 route list match 0/0 | cut -d' ' -f3
ip -4 route list match 0/0 | cut -d' ' -f3
</pre>
== List all container IPs ==
<pre>
docker ps -q | xargs -n 1 docker inspect --format '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}} {{ .Name }}' | sed 's/ \// /'
</pre>
</pre>



Latest revision as of 11:46, 17 July 2019

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/ \// /'