summaryrefslogtreecommitdiff
path: root/scripts/docker/helper/get-container-ip.sh
blob: 2b392350297309cf8708d569e62885e478d2e023 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#!/bin/sh

# Print the IP of a container to stdout, given its id. Check the output for
# the `docker inspect` commmand for more details:
#
#   https://docs.docker.com/engine/reference/commandline/inspect/

if [ ${#} -ne 1 ]; then
  echo "Usage: ${0} container_id"
  exit 1
fi

container_id=${1}

/usr/bin/docker \
  inspect \
  --format='{{.NetworkSettings.IPAddress}}' \
  ${container_id}