Created
October 4, 2018 04:12
-
-
Save JupyterJones/d4c870f0c3279ace95c31b3cbd204b42 to your computer and use it in GitHub Desktop.
Get the ip address of a running container
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# USAGE: GETip -container- Example: | |
# GETip 9837705e48ae | |
# will return 172.17.0.2 | |
docker inspect $1 | jq -r .[0].NetworkSettings.IPAddress |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
#!/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.