Read-only archive. These discussions are from Tracston's earlier
technical forum and are kept online because the answers are still useful.
New replies are closed. Need help with something like this?
Talk to us.
Question
16 Mar 2021
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>>
Reply 1
16 Mar 2021
in one line for scripting
docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' `docker ps -a | grep <<CONTAINER NAME>> | awk '{print $1}'`
Need this fixed properly?
We do this for a living.
Kubernetes, DevOps and platform engineering, delivered in days — not another weekend lost to a stack trace.
Start a project →