Browse Source

new: dev: provide ``get_container_network_ips`` to charms

test
Valentin Lab 6 years ago
parent
commit
5c0317d240
  1. 18
      bin/compose-core

18
bin/compose-core

@ -774,6 +774,24 @@ get_running_containers_for_service() {
export -f get_running_containers_for_service export -f get_running_containers_for_service
get_container_network_ips() {
local container="$1"
docker inspect "$container" \
--format='{{range $key, $val :=.NetworkSettings.Networks}}{{$key}}{{"\x00"}}{{$val.IPAddress}}{{"\x00"}}{{end}}'
}
export -f get_container_network_ips
get_container_network_ip() {
local container="$1"
while read-0 network ip; do
printf "%s\0" "$network" "$ip"
break
done < <(get_container_network_ips "$container")
}
export -f get_container_network_ip
## ##
## Internal Process ## Internal Process
## ##

Loading…
Cancel
Save