Forum breadcrumbs – You are here:Tracston Community Forum – DevOps, Micro Services, Cloud, Infrastructure, Development, Monitoring and more…DevOps / Micro Services / Automation: DockerHow to get container IP address
You need to log in to create posts and topics.
How to get container IP address
moshe@moshe
#1 · 16/03/2021, 2:13 pm
Quote from moshe on 16/03/2021, 2:13 pmProblem
User wants to get container IP address
Solution
sudo docker ps −a #select your container id docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' <<CONTAINER ID>>
Problem
User wants to get container IP address
Solution
sudo docker ps −a #select your container id docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' <<CONTAINER ID>>
Click for thumbs down.0Click for thumbs up.0
moshe@moshe
#2 · 16/03/2021, 2:14 pm
Quote from moshe on 16/03/2021, 2:14 pmin one line for scripting
docker inspect -f ‘{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}’ `docker ps -a | grep <<CONTAINER NAME>> | awk ‘{print $1}’`
in one line for scripting
docker inspect -f ‘{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}’ `docker ps -a | grep <<CONTAINER NAME>> | awk ‘{print $1}’`
Click for thumbs down.0Click for thumbs up.0