Skip to content

Instantly share code, notes, and snippets.

@JupyterJones
Created October 4, 2018 04:12
Show Gist options
  • Save JupyterJones/d4c870f0c3279ace95c31b3cbd204b42 to your computer and use it in GitHub Desktop.
Save JupyterJones/d4c870f0c3279ace95c31b3cbd204b42 to your computer and use it in GitHub Desktop.
Get the ip address of a running container
#!/bin/bash
# USAGE: GETip -container- Example:
# GETip 9837705e48ae
# will return 172.17.0.2
docker inspect $1 | jq -r .[0].NetworkSettings.IPAddress
@JupyterJones
Copy link
Author

#!/bin/bash

USAGE: GETip -container- Example:

GETip 9837705e48ae

will return 172.17.0.2

docker inspect $1 | jq -r .[0].NetworkSettings.IPAddress
$ chmod +x GETip.sh
You may save script as:
GETip
then cp to /usr/local/bin then it can be easily accessed from any directory.

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