Skip to content

Instantly share code, notes, and snippets.

@vitojeng
Last active June 1, 2017 03:42
Show Gist options
  • Save vitojeng/cb884c5b2fb3bd06e68021efb0c62b2d to your computer and use it in GitHub Desktop.
Save vitojeng/cb884c5b2fb3bd06e68021efb0c62b2d to your computer and use it in GitHub Desktop.
List all docker container name and ip address
function docker_container_ip() {
  container_ids=$(docker ps -aq)
  for cid in ${container_ids}
  do
    info=$(docker inspect -f 'name={{.Name}}  ip={{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' ${cid})
    echo -e "$cid \t $info"
  done
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment