I got an container ip but do not know which it is, which should be one of dozens containers. So, what the fastest way to find it out?
Thanks all.
docker inspect --format={{.Id}}-{{.NetworkSettings.IPAddress}} $(docker ps -aq)|grep $IPtry this :
echo $(docker ps -a -q) | xargs docker inspect --format '{{ .NetworkSettings.IPAddress }} {{.Id}}' | grep MY_IPresult :
MY_IP fe82613520e138039924f979899bc46a40312687361a98b9a670273a0340f48cI see you have tagged your question with Kubernetes, so I am assuming you are using that.
Here is how to get container(s) by IP address in k8s:
kubectl get pod -ojsonpath='{range .items[*]}{@.metadata.name}{" "}{@.status.podIP}{"\n"}' | grep 127.0.0.1 # <==== Your IP