I would like to get the ipaddress of the containers and I trying to figure out how using python docker APIs.
Something like this I would like to do it in python APIs
docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' container_name_or_id
I tried this and coming back null for ip address
import docker
dockerClient = docker.from_env()
client = docker.APIClient(base_url='unix://var/run/docker.sock')
for container in dockerClient.containers.list():
print container.id
print "-------------"
print client.inspect_container(container.id)['NetworkSettings']['IPAddress']