Create a gist now

Instantly share code, notes, and snippets.

@stondo /
Created Apr 18, 2016

What would you like to do?
if [[ -n "$docker_container_name" ]]; then
docker inspect $docker_container_name | grep '"IPAddress' | cut -d '"' -f4 | awk '{print $1}' | uniq
ifconfig docker0 | grep "inet addr" | cut -d: -f2 | awk '{print $1}'

stondo commented Apr 18, 2016

Handy bash script to get the internal IP address of your docker containers by passing either CONTAINER_ID or NAME.
If no parameter is given, it will just output the IP of docker0 interface.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment